Skip to content

Commit

Permalink
fix some issues with test
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
mashetty330 committed Mar 8, 2024
1 parent 0b4356a commit 0fe00fa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
20 changes: 0 additions & 20 deletions ocs_ci/ocs/bucket_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2040,25 +2040,6 @@ def patch_replication_policy_to_bucketclass(
).patch(params=json.dumps(replication_policy_patch_dict), format_type="merge")


def remove_replication_policy(bucket_name):
"""
Remove replication policy for a bucket
Args:
bucket_name(str): Name of the bucket
"""
replication_policy_patch_dict = {
"spec": {"additionalConfig": {{"replicationPolicy": ""}}}
}

OCP(
kind="obc",
namespace=config.ENV_DATA["cluster_namespace"],
resource_name=bucket_name,
).patch(params=json.dumps(replication_policy_patch_dict), format_type="merge")


def random_object_round_trip_verification(
io_pod,
bucket_name,
Expand Down Expand Up @@ -2659,4 +2640,3 @@ def delete_objects_from_source_and_wait_for_deletion_sync(
target_bucket.name,
timeout=timeout,
), f"Deletion sync failed to complete in {timeout} seconds"

7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7352,7 +7352,6 @@ def scale_noobaa_resources():
log.info("Scaled noobaa pod resources")
time.sleep(60)


@pytest.fixture(scope="function")
def create_scale_pods_and_pvcs_using_kube_job_on_hci_clients(request):
"""
Expand Down Expand Up @@ -7442,7 +7441,8 @@ def finalizer():
request.addfinalizer(finalizer)
return factory

@pytest.fixture(scope="class")

@pytest.fixture()
def reduce_replication_delay_setup(add_env_vars_to_noobaa_core_class):
"""
A fixture to reduce the replication delay to one minute.
Expand Down Expand Up @@ -7481,6 +7481,8 @@ def aws_log_based_replication_setup(
Bucket: The target bucket
"""

reduce_replication_delay_setup()

def factory(bucketclass_dict=None):
log.info("Starting log-based replication setup")
if bucketclass_dict is None:
Expand Down Expand Up @@ -7517,4 +7519,3 @@ def factory(bucketclass_dict=None):
return mockup_logger, source_bucket, target_bucket

return factory

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
write_random_test_objects_to_bucket,
upload_test_objects_to_source_and_wait_for_replication,
update_replication_policy,
remove_replication_policy,
)
from ocs_ci.ocs import ocp
from ocs_ci.ocs.resources.pvc import get_pvc_objs
Expand All @@ -38,8 +37,8 @@
get_rgw_pods,
get_noobaa_db_pod,
get_noobaa_core_pod,
wait_for_storage_pods,
get_noobaa_pods,
wait_for_noobaa_pods_running,
)
from ocs_ci.utility.retry import retry
from ocs_ci.ocs.exceptions import CommandFailed, ResourceWrongStatusException
Expand Down Expand Up @@ -348,12 +347,12 @@ def delete_objs_in_batch():
mcg_obj_session,
source_bucket.name,
target_bucket.name,
timeout=600,
timeout=300,
), "Deletion sync was done but not expected"

# Do noobaa db recovery and see if the deletion sync works now
noobaa_db_recovery_from_backup(snap_obj, noobaa_pvc_obj, noobaa_pods)
wait_for_storage_pods()
wait_for_noobaa_pods_running(timeout=420)

assert compare_bucket_object_list(
mcg_obj_session,
Expand All @@ -364,19 +363,18 @@ def delete_objs_in_batch():

# Remove replication policy and upload some objects to the bucket
# make sure the replication itself doesn't take place
remove_replication_policy(source_bucket.name)
disable_replication = source_bucket.replication_policy
disable_replication["rules"] = []
update_replication_policy(source_bucket.name, dict())

logger.info("Uploading test objects and waiting for replication to complete")
mockup_logger.upload_test_objs_and_log(source_bucket.name)

logger.info(
"Resetting the noobaa-core pod to trigger the replication background worker"
)

assert not compare_bucket_object_list(
mcg_obj_session,
source_bucket.name,
target_bucket.name,
timeout=600,
timeout=300,
), "Standard replication completed even though replication policy is removed"

validate_mcg_bg_features(
Expand Down

0 comments on commit 0fe00fa

Please sign in to comment.