Skip to content

Commit

Permalink
create fixture for creating vms using standalone pvc
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
mashetty330 committed Jul 11, 2024
1 parent 818c196 commit 8a6f7b7
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
upgrade_marks,
ignore_resource_not_found_error_label,
)
from ocs_ci.helpers.cnv_helpers import (
create_vm_using_standalone_pvc,
get_pvc_from_vm,
get_secret_from_vm,
get_volumeimportsource,
)
from ocs_ci.helpers.proxy import update_container_with_proxy_env
from ocs_ci.ocs import constants, defaults, fio_artefacts, node, ocp, platform_nodes
from ocs_ci.ocs.acm.acm import login_to_acm
Expand Down Expand Up @@ -7817,3 +7823,28 @@ def finalizer():

request.addfinalizer(finalizer)
return factory


@pytest.fixture()
def setup_vms_standalone_pvc(request, project_factory):
"""
This fixture will setup VM using standalone PVC
"""

project_obj = project_factory()
log.info(f"Created project {project_obj.namespace} for VMs")
vm_obj = create_vm_using_standalone_pvc(
running=True, namespace=project_obj.namespace
)

def finalizer():
pvc_obj = get_pvc_from_vm(vm_obj)
secret_obj = get_secret_from_vm(vm_obj)
volumeimportsource_obj = get_volumeimportsource(pvc_obj=pvc_obj)
vm_obj.delete()
pvc_obj.delete()
secret_obj.delete()
volumeimportsource_obj.delete()

request.addfinalizer(finalizer)

0 comments on commit 8a6f7b7

Please sign in to comment.