add lifecycle expiration test mixing 2-tag filter w/versioning

By design this test duplicates test_lifecycle_expiration_tags2,
but enables object versioning on the bucket.

The tests install a rule which requires -2- tags to be matched,
and creates 2 objects, one matching only 1 of the required tags,
the other matching both.  Only the 2nd object should expire.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
This commit is contained in:
Matt Benjamin 2020-09-15 09:57:00 -04:00
parent b930f194e4
commit c9792cb975

View file

@ -9053,16 +9053,8 @@ def test_lifecycle_expiration_tags1():
eq(len(expire_objects), 0) eq(len(expire_objects), 0)
@attr(resource='bucket') # factor out common setup code
@attr(method='put') def setup_lifecycle_tags2(client, bucket_name):
@attr(operation='test lifecycle expiration with 2 tags')
@attr('lifecycle')
@attr('lifecycle_expiration')
@attr('fails_on_aws')
def test_lifecycle_expiration_tags2():
bucket_name = get_new_bucket()
client = get_client()
tom_key = 'days1/tom' tom_key = 'days1/tom'
tom_tagset = {'TagSet': tom_tagset = {'TagSet':
[{'Key': 'tom', 'Value': 'sawyer'}]} [{'Key': 'tom', 'Value': 'sawyer'}]}
@ -9116,6 +9108,40 @@ def test_lifecycle_expiration_tags2():
response = client.put_bucket_lifecycle_configuration( response = client.put_bucket_lifecycle_configuration(
Bucket=bucket_name, LifecycleConfiguration=lifecycle_config) Bucket=bucket_name, LifecycleConfiguration=lifecycle_config)
eq(response['ResponseMetadata']['HTTPStatusCode'], 200) eq(response['ResponseMetadata']['HTTPStatusCode'], 200)
return response
@attr(resource='bucket')
@attr(method='put')
@attr(operation='test lifecycle expiration with 2 tags')
@attr('lifecycle')
@attr('lifecycle_expiration')
@attr('fails_on_aws')
def test_lifecycle_expiration_tags2():
bucket_name = get_new_bucket()
client = get_client()
response = setup_lifecycle_tags2(client, bucket_name)
time.sleep(28)
response = client.list_objects(Bucket=bucket_name)
expire1_objects = response['Contents']
eq(len(expire1_objects), 1)
@attr(resource='bucket')
@attr(method='put')
@attr(operation='test lifecycle expiration with versioning and 2 tags')
@attr('lifecycle')
@attr('lifecycle_expiration')
@attr('fails_on_aws')
def test_lifecycle_expiration_versioned_tags2():
bucket_name = get_new_bucket()
client = get_client()
# mix in versioning
check_configure_versioning_retry(bucket_name, "Enabled", "Enabled")
response = setup_lifecycle_tags2(client, bucket_name)
time.sleep(28) time.sleep(28)
response = client.list_objects(Bucket=bucket_name) response = client.list_objects(Bucket=bucket_name)