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 <mbenjamin@redhat.com>
This commit is contained in:
Matt Benjamin 2020-09-11 10:17:39 -04:00
parent 7d14452035
commit ea9f07a2bf

View file

@ -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)