Skip to content

Commit

Permalink
[Customer-BZ][Automation]: radosgw-admin lc process --bucket <bucket>…
Browse files Browse the repository at this point in the history
… doesn't remove objects if versioning is suspended

Signed-off-by: Chaithra <ckulal@redhat.com>
  • Loading branch information
ckulal committed Jan 10, 2025
1 parent 4a04779 commit fcf0b89
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Customer BZ:2319199
# Polarian ID: CEPH-83574809
# Script file: s3_swift/test_bucket_lifecycle_object_expiration_transition.py
config:
user_count: 1
bucket_count: 1
objects_count: 10
parallel_lc: false
rgw_lc_debug_interval: 600
rgw_enable_lc_threads: false
objects_size_range:
min: 5
max: 15
test_ops:
create_bucket: true
create_object: true
enable_versioning: false
lc_process_with_ver_suspended: true
lifecycle_conf:
- ID: LC_Rule_1
Filter:
Prefix: key1
Status: Enabled
Expiration:
Date: "2022-01-01"
23 changes: 23 additions & 0 deletions rgw/v2/tests/s3_swift/reusable.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,29 @@ def enable_versioning(bucket, rgw_conn, user_info, write_bucket_io_info):
raise TestExecError("version enable failed")


def suspend_versioning(bucket, rgw_conn, user_info, write_bucket_io_info):
"""
Method to perform suspend versioning operation
bucket: Name of teh bucket
rgw_conn: rgw connection
user_info: user info
"""
bucket_versioning = s3lib.resource_op(
{"obj": rgw_conn, "resource": "BucketVersioning", "args": [bucket.name]}
)
version_suspended_status = s3lib.resource_op(
{"obj": bucket_versioning, "resource": "suspend", "args": None}
)
suspended_response = HttpResponseParser(version_suspended_status)
if suspended_response.status_code == 200:
log.info("version Suspended Successfully")
write_bucket_io_info.add_versioning_status(
user_info["access_key"], bucket.name, "suspended"
)
else:
raise TestExecError("Suspending versioning is failed")


def generate_totp(seed):
cmd = "oathtool -d6 --totp %s" % seed
totp_token = utils.exec_shell_cmd(cmd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
test_lc_transition_with_lc_process.yaml
test_sse_kms_per_bucket_multipart_object_download_after_transition.yaml
test_lc_cloud_transition_restore_object.yaml
<<<<<<< HEAD
=======
test_lc_process_with_versioning_suspended.yaml
>>>>>>> c321a75 ([Customer-BZ][Automation]: radosgw-admin lc process --bucket <bucket> doesn't remove objects if versioning is suspended)
Operation:
Expand Down Expand Up @@ -412,7 +416,11 @@ def test_exec(config, ssh_con):
continue
time.sleep(30)
lc_ops.validate_and_rule(bucket, config)
elif not config.invalid_date and not config.rgw_enable_lc_threads:
elif (
not config.invalid_date
and not config.rgw_enable_lc_threads
and not config.test_ops.get("lc_process_with_ver_suspended")
):
bucket_before_lc = json.loads(
utils.exec_shell_cmd(
f"radosgw-admin bucket stats --bucket={bucket.name}"
Expand Down Expand Up @@ -459,6 +467,32 @@ def test_exec(config, ssh_con):
)
time.sleep(30)
lc_ops.validate_and_rule(bucket, config)
elif config.test_ops.get("lc_process_with_ver_suspended", False):
log.info(
"Test Manual LC Process with versioning suspended on the bucket"
)
reusable.suspend_versioning(
bucket, rgw_conn, each_user, write_bucket_io_info
)
life_cycle_rule = {"Rules": config.lifecycle_conf}
reusable.put_bucket_lifecycle(
bucket,
rgw_conn,
rgw_conn2,
life_cycle_rule,
)
cmd = f"radosgw-admin lc process --bucket {bucket_name}"
out = utils.exec_shell_cmd(cmd)
cmd = f"radosgw-admin lc list"
lc_list = json.loads(utils.exec_shell_cmd(cmd))
for data in lc_list:
if data["bucket"] == bucket_name:
if data["status"] == "UNINITIAL":
raise TestExecError(
f"manual lc process for bucket: {bucket_name} failed"
)
time.sleep(30)
lc_ops.validate_prefix_rule_non_versioned(bucket, config)
else:
bucket_life_cycle = s3lib.resource_op(
{
Expand Down

0 comments on commit fcf0b89

Please sign in to comment.