Skip to content

Commit

Permalink
Rebase and fix some of the code
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
Mahesh Shetty authored and Mahesh Shetty committed Jan 23, 2025
1 parent a250e1d commit 64a4d37
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from ocs_ci.framework.pytest_customization.marks import (
turquoise_squad,
stretchcluster_required,
tier1,
)
from ocs_ci.helpers.cnv_helpers import cal_md5sum_vm
from ocs_ci.ocs import constants
from ocs_ci.ocs.resources import storage_cluster
from ocs_ci.ocs.resources.pod import (
Expand All @@ -18,6 +20,7 @@
logger = logging.getLogger(__name__)


@tier1
@turquoise_squad
@stretchcluster_required
class TestAddCapacityStretchCluster:
Expand Down Expand Up @@ -85,6 +88,7 @@ def test_cluster_expansion(
setup_logwriter_rbd_workload_factory,
logreader_workload_factory,
iterations,
setup_cnv,
cnv_workload,
):
"""
Expand All @@ -109,11 +113,11 @@ def test_cluster_expansion(
logger.info("All the workloads pods are successfully up and running")

# setup vm and write some data to the VM instance
vm_obj = cnv_workload(volume_interface=constants.VM_VOLUME_PVC)[0]
vm_obj = cnv_workload(volume_interface=constants.VM_VOLUME_PVC)
vm_obj.run_ssh_cmd(
command="dd if=/dev/zero of=/file_1.txt bs=1024 count=102400"
)
md5sum_before = vm_obj.run_ssh_cmd(command="md5sum /file_1.txt")
md5sum_before = cal_md5sum_vm(vm_obj, file_path="/file_1.txt")

start_time = datetime.now(timezone.utc)

Expand All @@ -132,7 +136,7 @@ def test_cluster_expansion(
logger.info("Successfully verified with post failure checks for the workloads")

# check vm data written before the failure for integrity
md5sum_after = vm_obj.run_ssh_cmd(command="md5sum /file_1.txt")
md5sum_after = cal_md5sum_vm(vm_obj, file_path="/file_1.txt")
assert (
md5sum_before == md5sum_after
), "Data integrity of the file inside VM is not maintained during the add capacity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
stretchcluster_required,
turquoise_squad,
polarion_id,
tier1,
)
from ocs_ci.helpers.cnv_helpers import cal_md5sum_vm
from ocs_ci.ocs import constants
from ocs_ci.ocs.resources.pod import wait_for_pods_to_be_in_statuses

Expand All @@ -15,9 +17,11 @@
logger = logging.getLogger(__name__)


@tier1
@stretchcluster_required
@turquoise_squad
class TestDeviceReplacementInStretchCluster:

@polarion_id("OCS-5047")
def test_device_replacement(
self,
Expand Down Expand Up @@ -56,11 +60,11 @@ def test_device_replacement(
logger.info("All the workloads pods are successfully up and running")

# setup vm and write some data to the VM instance
vm_obj = cnv_workload(volume_interface=constants.VM_VOLUME_PVC)[0]
vm_obj = cnv_workload(volume_interface=constants.VM_VOLUME_PVC)
vm_obj.run_ssh_cmd(
command="dd if=/dev/zero of=/file_1.txt bs=1024 count=102400"
)
md5sum_before = vm_obj.run_ssh_cmd(command="md5sum /file_1.txt")
md5sum_before = cal_md5sum_vm(vm_obj, file_path="/file_1.txt")

start_time = datetime.now(timezone.utc)

Expand All @@ -77,7 +81,7 @@ def test_device_replacement(
logger.info("Successfully verified with post failure checks for the workloads")

# check vm data written before the failure for integrity
md5sum_after = vm_obj.run_ssh_cmd(command="md5sum /file_1.txt")
md5sum_after = cal_md5sum_vm(vm_obj, file_path="/file_1.txt")
assert (
md5sum_before == md5sum_after
), "Data integrity of the file inside VM is not maintained during the device replacement"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
polarion_id,
stretchcluster_required,
turquoise_squad,
tier2,
)
from ocs_ci.helpers.cnv_helpers import cal_md5sum_vm
from ocs_ci.helpers.helpers import modify_deployment_replica_count
Expand Down Expand Up @@ -147,7 +148,7 @@ def setup_cnv_workload(request, cnv_workload_class, setup_cnv):
logger.info("Setting up CNV workload and creating some data")
vm_obj = cnv_workload_class(
volume_interface=constants.VM_VOLUME_PVC, namespace=CNV_WORKLOAD_NAMESPACE
)[0]
)
vm_obj.run_ssh_cmd(command="dd if=/dev/zero of=/file_1.txt bs=1024 count=102400")
md5sum_before = cal_md5sum_vm(vm_obj, file_path="/file_1.txt")

Expand Down Expand Up @@ -181,6 +182,7 @@ def finalizer():
request.addfinalizer(finalizer)


@tier2
@turquoise_squad
@stretchcluster_required
@pytest.mark.usefixtures("setup_cnv_workload")
Expand Down

0 comments on commit 64a4d37

Please sign in to comment.