Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
mashetty330 committed Mar 13, 2024
1 parent 277bfb1 commit b7333fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7480,6 +7480,7 @@ def aws_log_based_replication_setup(
MockupBucketLogger: A MockupBucketLogger object
Bucket: The source bucket
Bucket: The target bucket
"""

reduce_replication_delay_setup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ def test_replication_with_disruptions(
@magenta_squad
@skipif_vsphere_ipi
class TestLogBasedReplicationWithDisruptions:
@retry(Exception, tries=10, delay=5)
def delete_objs_in_batch(self, objs_to_delete, mockup_logger, source_bucket):
"""
This function deletes objects in a batch
"""
for obj in objs_to_delete:
mockup_logger.delete_objs_and_log(source_bucket.name, [obj])
time.sleep(5)
logger.info(f"Successfully deleted these objects: {objs_to_delete}")

@polarion_id("OCS-5457")
@bugzilla("2266805")
def test_log_based_replication_with_disruptions(
Expand Down Expand Up @@ -279,7 +289,6 @@ def test_log_based_replication_with_disruptions(
make sure no replication - no deletion sync works
"""

# entry criteria setup
feature_setup_map = setup_mcg_bg_features(
num_of_buckets=5,
Expand All @@ -305,17 +314,10 @@ def test_log_based_replication_with_disruptions(
objs_in_bucket = mockup_logger.standard_test_obj_list
objs_to_delete = random.sample(objs_in_bucket, 3)

from ocs_ci.utility.retry import retry

@retry(Exception, tries=10, delay=5)
def delete_objs_in_batch():
for obj in objs_to_delete:
mockup_logger.delete_objs_and_log(source_bucket.name, [obj])
time.sleep(5)
logger.info(f"Successfully deleted these objects: {objs_to_delete}")

with ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(delete_objs_in_batch)
future = executor.submit(
self.delete_objs_in_batch, objs_to_delete, mockup_logger, source_bucket
)

# Restart noobaa pods
nb_core_pod = get_noobaa_core_pod()
Expand Down

0 comments on commit b7333fe

Please sign in to comment.