Skip to content

Commit

Permalink
add cnv workloads to the add capacity and device replacement tests
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 8b00a27 commit a250e1d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/functional/disaster-recovery/sc_arbiter/test_add_capacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def test_cluster_expansion(
setup_logwriter_rbd_workload_factory,
logreader_workload_factory,
iterations,
cnv_workload,
):
"""
Test cluster exapnsion and health when add capacity is performed
Expand All @@ -107,6 +108,13 @@ 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.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")

start_time = datetime.now(timezone.utc)

sc_obj.get_logfile_map(label=constants.LOGWRITER_CEPHFS_LABEL)
Expand All @@ -123,6 +131,29 @@ def test_cluster_expansion(
sc_obj.post_failure_checks(start_time, end_time, wait_for_read_completion=False)
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")
assert (
md5sum_before == md5sum_after
), "Data integrity of the file inside VM is not maintained during the add capacity"
logger.info(
"Data integrity of the file inside VM is maintained during the add capacity"
)

# check if new data can be created
vm_obj.run_ssh_cmd(
command="dd if=/dev/zero of=/file_2.txt bs=1024 count=103600"
)
logger.info("Successfully created new data inside VM")

# check if the data can be copied back to local machine
vm_obj.scp_from_vm(local_path="/tmp", vm_src_path="/file_1.txt")
logger.info("VM data is successfully copied back to local machine")

# stop the VM
vm_obj.stop()
logger.info("Stoped the VM successfully")

sc_obj.cephfs_logreader_job.delete()
logger.info(sc_obj.cephfs_logreader_pods)
for pod in sc_obj.cephfs_logreader_pods:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def test_device_replacement(
setup_logwriter_cephfs_workload_factory,
setup_logwriter_rbd_workload_factory,
logreader_workload_factory,
cnv_workload,
setup_cnv,
):
"""
Test device replacement in stretch cluster while logwriter workload
Expand Down Expand Up @@ -53,6 +55,13 @@ 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.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")

start_time = datetime.now(timezone.utc)

sc_obj.get_logfile_map(label=constants.LOGWRITER_CEPHFS_LABEL)
Expand All @@ -67,6 +76,29 @@ def test_device_replacement(
sc_obj.post_failure_checks(start_time, end_time, wait_for_read_completion=False)
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")
assert (
md5sum_before == md5sum_after
), "Data integrity of the file inside VM is not maintained during the device replacement"
logger.info(
"Data integrity of the file inside VM is maintained during the device replacement"
)

# check if new data can be created
vm_obj.run_ssh_cmd(
command="dd if=/dev/zero of=/file_2.txt bs=1024 count=103600"
)
logger.info("Successfully created new data inside VM")

# check if the data can be copied back to local machine
vm_obj.scp_from_vm(local_path="/tmp", vm_src_path="/file_1.txt")
logger.info("VM data is successfully copied back to local machine")

# stop the VM
vm_obj.stop()
logger.info("Stoped the VM successfully")

sc_obj.cephfs_logreader_job.delete()
logger.info(sc_obj.cephfs_logreader_pods)
for pod in sc_obj.cephfs_logreader_pods:
Expand Down

0 comments on commit a250e1d

Please sign in to comment.