]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Add a case for lifecycle expiration on versining enabled bucket.
authorzhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Fri, 28 Jun 2019 08:15:56 +0000 (16:15 +0800)
committerzhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Fri, 28 Jun 2019 08:15:56 +0000 (16:15 +0800)
Signed-off-by: zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
s3tests_boto3/functional/test_s3.py

index 06522239885eaace11f0e6c11441a308160eb7ec..47b9b1e9aa3f06085e628bd0cf128d0084253945 100644 (file)
@@ -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')