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