From ea9f07a2bffdd619e4155ec71eb92afc2847b27e Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Fri, 11 Sep 2020 10:17:39 -0400 Subject: [PATCH] fix and remark on test_lifecycle_expiration_days0 1. fix a python3-related KeyError exception 2. note here: AWS documentation includes examples of "Days 0" in use, but boto3 will not accept them--this is why the days0 test currently sets Days 1 3. delay increased to 30s, to avoid occasional failures due to jitter Signed-off-by: Matt Benjamin --- s3tests_boto3/functional/test_s3.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 969d28f..3fa7657 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -9128,14 +9128,17 @@ def test_lifecycle_expiration_days0(): rules=[{'Expiration': {'Days': 1}, 'ID': 'rule1', 'Prefix': 'days0/', 'Status':'Enabled'}] lifecycle = {'Rules': rules} - print(lifecycle) + response = client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle) eq(response['ResponseMetadata']['HTTPStatusCode'], 200) - time.sleep(20) + time.sleep(30) response = client.list_objects(Bucket=bucket_name) - expire_objects = response['Contents'] + try: + expire_objects = response['Contents'] + except KeyError: + expire_objects = [] eq(len(expire_objects), 0)