From 1effe15a40557b89c4187bbdc38b7cfaf4808ce2 Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Wed, 9 Oct 2024 22:53:19 +0530 Subject: [PATCH] Updating lifecycle_noncur* tests to include objects with instance empty Signed-off-by: Soumya Koduri (cherry picked from commit 7362e522cc1f0269949e2f8c2e80e6d6e8e0d0cc) --- s3tests_boto3/functional/test_s3.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index f18401a..2997771 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -9327,6 +9327,14 @@ def test_lifecycle_noncur_transition(): bucket = get_new_bucket() client = get_client() + + # before enabling versioning, create a plain entry + # which should get transitioned/expired similar to + # other non-current versioned entries. + key = 'test1/a' + content = 'fooz' + client.put_object(Bucket=bucket, Key=key, Body=content) + check_configure_versioning_retry(bucket, "Enabled", "Enabled") rules = [ @@ -9352,7 +9360,7 @@ def test_lifecycle_noncur_transition(): lifecycle = {'Rules': rules} response = client.put_bucket_lifecycle_configuration(Bucket=bucket, LifecycleConfiguration=lifecycle) - create_multiple_versions(client, bucket, "test1/a", 3) + create_multiple_versions(client, bucket, "test1/a", 2) create_multiple_versions(client, bucket, "test1/b", 3) init_keys = list_bucket_storage_class(client, bucket) @@ -9608,6 +9616,14 @@ def test_lifecycle_noncur_cloud_transition(): bucket = get_new_bucket() client = get_client() + + # before enabling versioning, create a plain entry + # which should get transitioned/expired similar to + # other non-current versioned entries. + key = 'test1/a' + content = 'fooz' + client.put_object(Bucket=bucket, Key=key, Body=content) + check_configure_versioning_retry(bucket, "Enabled", "Enabled") rules = [ @@ -9632,8 +9648,8 @@ def test_lifecycle_noncur_cloud_transition(): keys = ['test1/a', 'test1/b'] - for k in keys: - create_multiple_versions(client, bucket, k, 3) + create_multiple_versions(client, bucket, "test1/a", 2) + create_multiple_versions(client, bucket, "test1/b", 3) init_keys = list_bucket_storage_class(client, bucket) assert len(init_keys['STANDARD']) == 6