From 6b15523752335f8d93051c893067e29ab6ba8665 Mon Sep 17 00:00:00 2001 From: Avdhoot Date: Wed, 18 Dec 2024 12:01:46 +0530 Subject: [PATCH] Added changes Signed-off-by: Avdhoot --- .../cnv-vm-workload/cnv_vm_workload.yaml | 2 +- tests/conftest.py | 10 ++------ .../cnv/test_multi_vm_configurations.py | 23 ++++++++++--------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/ocs_ci/templates/cnv-vm-workload/cnv_vm_workload.yaml b/ocs_ci/templates/cnv-vm-workload/cnv_vm_workload.yaml index ae9a69ca355..38a8eea7d3a 100644 --- a/ocs_ci/templates/cnv-vm-workload/cnv_vm_workload.yaml +++ b/ocs_ci/templates/cnv-vm-workload/cnv_vm_workload.yaml @@ -1,4 +1,4 @@ -vm_configs: +cnv_vm_configs: - volume_interface: PVC access_mode: ReadWriteMany sc_compression: default diff --git a/tests/conftest.py b/tests/conftest.py index 191d786f109..279ed07a9d6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7103,7 +7103,7 @@ def multi_cnv_workload( Fixture to create virtual machines (VMs) with specific configurations. This fixture sets up multiple VMs with varying storage configurations as specified - in the `vm_configs` yaml. Each VM configuration includes the volume interface type, + in the `cnv_vm_workload.yaml`. Each VM configuration includes the volume interface type, access mode, and the storage class to be used. The configurations applied to the VMs are: @@ -7166,7 +7166,6 @@ def factory(namespace=None): log.info(f"Successfully patched parameters for storage class: {sc}") except Exception as e: log.info(f"Failed to patch storage class {sc}: {e}") - continue # Create ceph-csi-kms-token in the tenant namespace kms.vault_path_token = kms.generate_vault_token() @@ -7180,17 +7179,12 @@ def factory(namespace=None): vm_configs = templating.load_yaml(constants.CNV_VM_WORKLOADS) # Loop through vm_configs and create the VMs using the cnv_workload fixture - for index, vm_config in enumerate(vm_configs["vm_configs"]): + for index, vm_config in enumerate(vm_configs["cnv_vm_configs"]): # Determine the storage class based on the compression type if vm_config["sc_compression"] == "default": storageclass = sc_obj_def_compr.name elif vm_config["sc_compression"] == "aggressive": storageclass = sc_obj_aggressive.name - else: - raise ValueError( - f"Unknown storage class compression type: {vm_config['sc_name']}" - ) - vm_obj = cnv_workload( volume_interface=vm_config["volume_interface"], access_mode=vm_config["access_mode"], diff --git a/tests/functional/workloads/cnv/test_multi_vm_configurations.py b/tests/functional/workloads/cnv/test_multi_vm_configurations.py index 39e5799ee1c..c4e87b283aa 100644 --- a/tests/functional/workloads/cnv/test_multi_vm_configurations.py +++ b/tests/functional/workloads/cnv/test_multi_vm_configurations.py @@ -38,6 +38,14 @@ def setup(self, project_factory, multi_cnv_workload): logger.info("All vms created successfully") def verify_keyrotation(self, vm_objs, sc_obj): + """ + Verify the keyrotation is succeed. + + Args: + vm_objs (obj): virtual machine Object + sc_obj (obj): storage class object + + """ for vm in vm_objs: if vm.volume_interface == constants.VM_VOLUME_PVC: pvk_obj = PVKeyrotation(sc_obj) @@ -58,7 +66,7 @@ def verify_keyrotation(self, vm_objs, sc_obj): @workloads @pytest.mark.polarion_id("OCS-6298") - def test_cnv_vms(self, setup): + def test_cnv_vms(self, setup, setup_cnv): """ Tests to verify configuration for non-GS like environment @@ -74,19 +82,15 @@ def test_cnv_vms(self, setup): """ - # To Do - # 1. if os is windows then check rxbounce enabled in sc yaml - all_vm_list = self.vm_objs_def + self.vm_objs_aggr - # 2.Validate data integrity using md5sum. + # 1.Validate data integrity using md5sum. file_name = "/tmp/dd_file" vm_filepath = "/home/admin/dd_file1_copy" # Create file locally cmd = f"dd if=/dev/zero of={file_name} bs=1M count=1024" run_cmd(cmd) - # Calculate the MD5 checksum if file_name: cmd = f"md5sum {file_name}" @@ -101,14 +105,12 @@ def test_cnv_vms(self, setup): raise ValueError( "File name is not provided. Please specify a valid file name." ) - # Copy local file to all vms for vm_obj in all_vm_list: vm_obj.scp_to_vm( local_path=file_name, vm_dest_path=vm_filepath, ) - # Take md5sum of copied file and compare with md5sum taken locally for vm_obj in all_vm_list: md5sum_on_vm = cal_md5sum_vm(vm_obj, vm_filepath, username=None) @@ -116,13 +118,12 @@ def test_cnv_vms(self, setup): md5sum_on_vm == md5sum_on_local ), f"md5sum has changed after copying file on {vm_obj.name}" - # 3.Verify PV Keyrotation. + # 2.Verify PV Keyrotation. # Process VMs with default compression self.verify_keyrotation(self.vm_objs_def, self.sc_obj_def_compr) - # Process VMs with aggressive compression self.verify_keyrotation(self.vm_objs_aggr, self.sc_obj_aggressive) - # 4.Stop all VMs + # 3.Stop all VMs for vm_obj in all_vm_list: vm_obj.stop()