From b528485f62360a4b3106275329f34b0bbd0b05fb Mon Sep 17 00:00:00 2001 From: zhang Shaowen Date: Fri, 28 Jun 2019 16:15:56 +0800 Subject: [PATCH 1/2] Add a case for lifecycle expiration on versining enabled bucket. Signed-off-by: zhang Shaowen --- s3tests_boto3/functional/test_s3.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 0652223..47b9b1e 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -7925,6 +7925,31 @@ def test_lifecycle_expiration(): eq(len(keep2_objects), 4) eq(len(expire3_objects), 2) + +@attr(resource='bucket') +@attr(method='put') +@attr(operation='test lifecycle expiration on versining enabled bucket') +@attr('lifecycle') +@attr('lifecycle_expiration') +@attr('fails_on_aws') +def test_lifecycle_expiration_versioning_enabled(): + bucket_name = get_new_bucket() + client = get_client() + check_configure_versioning_retry(bucket_name, "Enabled", "Enabled") + create_multiple_versions(client, bucket_name, "test1/a", 1) + + rules=[{'ID': 'rule1', 'Expiration': {'Days': 1}, 'Prefix': 'test1/', 'Status':'Enabled'}] + lifecycle = {'Rules': rules} + client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle) + time.sleep(30) + + response = client.list_object_versions(Bucket=bucket_name) + versions = response['Versions'] + delete_markers = response['DeleteMarkers'] + eq(len(versions), 1) + eq(len(delete_markers), 1) + + @attr(resource='bucket') @attr(method='put') @attr(operation='id too long in lifecycle rule') From e54de402aaee3d0e538e1918edf7d68435dd5885 Mon Sep 17 00:00:00 2001 From: zhang Shaowen Date: Thu, 11 Jul 2019 16:36:16 +0800 Subject: [PATCH 2/2] update the case for lifecycle expiration on versioning enabled bucket Signed-off-by: zhang Shaowen --- s3tests_boto3/functional/test_s3.py | 1 + 1 file changed, 1 insertion(+) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 47b9b1e..a728af3 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -7937,6 +7937,7 @@ def test_lifecycle_expiration_versioning_enabled(): client = get_client() check_configure_versioning_retry(bucket_name, "Enabled", "Enabled") create_multiple_versions(client, bucket_name, "test1/a", 1) + client.delete_object(Bucket=bucket_name, Key="test1/a") rules=[{'ID': 'rule1', 'Expiration': {'Days': 1}, 'Prefix': 'test1/', 'Status':'Enabled'}] lifecycle = {'Rules': rules}