diff --git a/s3tests.conf.SAMPLE b/s3tests.conf.SAMPLE index 8e979df..a16b97e 100644 --- a/s3tests.conf.SAMPLE +++ b/s3tests.conf.SAMPLE @@ -41,6 +41,12 @@ secret_key = h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q== ## replace with key id obtained when secret is created, or delete if KMS not tested #kms_keyid = 01234567-89ab-cdef-0123-456789abcdef +## Storage classes +#storage_classes = "LUKEWARM, FROZEN" + +## Lifecycle debug interval (default: 10) +#lc_debug_interval = 20 + [s3 alt] # alt display_name set in vstart.sh display_name = john.doe diff --git a/s3tests_boto3/functional/__init__.py b/s3tests_boto3/functional/__init__.py index e940029..ebb0df0 100644 --- a/s3tests_boto3/functional/__init__.py +++ b/s3tests_boto3/functional/__init__.py @@ -198,6 +198,11 @@ def setup(): config.main_api_name = "" pass + try: + config.lc_debug_interval = int(cfg.get('s3 main',"lc_debug_interval")) + except (configparser.NoSectionError, configparser.NoOptionError): + config.lc_debug_interval = 10 + config.alt_access_key = cfg.get('s3 alt',"access_key") config.alt_secret_key = cfg.get('s3 alt',"secret_key") config.alt_display_name = cfg.get('s3 alt',"display_name") @@ -534,3 +539,6 @@ def get_token(): def get_realm_name(): return config.webidentity_realm + +def get_lc_debug_interval(): + return config.lc_debug_interval diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 47b24b8..47fe247 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -72,6 +72,7 @@ from . import ( get_secondary_kms_keyid, get_svc_client, nuke_prefixed_buckets, + get_lc_debug_interval, ) @@ -9032,21 +9033,23 @@ def test_lifecycle_expiration(): 'keep2/bar', 'expire3/foo', 'expire3/bar']) client = get_client() rules=[{'ID': 'rule1', 'Expiration': {'Days': 1}, 'Prefix': 'expire1/', 'Status':'Enabled'}, - {'ID': 'rule2', 'Expiration': {'Days': 4}, 'Prefix': 'expire3/', 'Status':'Enabled'}] + {'ID': 'rule2', 'Expiration': {'Days': 5}, 'Prefix': 'expire3/', 'Status':'Enabled'}] lifecycle = {'Rules': rules} client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle) response = client.list_objects(Bucket=bucket_name) init_objects = response['Contents'] - time.sleep(28) + lc_interval = get_lc_debug_interval() + + time.sleep(3*lc_interval) response = client.list_objects(Bucket=bucket_name) expire1_objects = response['Contents'] - time.sleep(10) + time.sleep(lc_interval) response = client.list_objects(Bucket=bucket_name) keep2_objects = response['Contents'] - time.sleep(20) + time.sleep(3*lc_interval) response = client.list_objects(Bucket=bucket_name) expire3_objects = response['Contents'] @@ -9067,21 +9070,23 @@ def test_lifecyclev2_expiration(): 'keep2/bar', 'expire3/foo', 'expire3/bar']) client = get_client() rules=[{'ID': 'rule1', 'Expiration': {'Days': 1}, 'Prefix': 'expire1/', 'Status':'Enabled'}, - {'ID': 'rule2', 'Expiration': {'Days': 4}, 'Prefix': 'expire3/', 'Status':'Enabled'}] + {'ID': 'rule2', 'Expiration': {'Days': 5}, 'Prefix': 'expire3/', 'Status':'Enabled'}] lifecycle = {'Rules': rules} client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle) response = client.list_objects_v2(Bucket=bucket_name) init_objects = response['Contents'] - time.sleep(28) + lc_interval = get_lc_debug_interval() + + time.sleep(3*lc_interval) response = client.list_objects_v2(Bucket=bucket_name) expire1_objects = response['Contents'] - time.sleep(10) + time.sleep(lc_interval) response = client.list_objects_v2(Bucket=bucket_name) keep2_objects = response['Contents'] - time.sleep(20) + time.sleep(3*lc_interval) response = client.list_objects_v2(Bucket=bucket_name) expire3_objects = response['Contents'] @@ -9106,7 +9111,10 @@ def test_lifecycle_expiration_versioning_enabled(): 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) + + lc_interval = get_lc_debug_interval() + + time.sleep(3*lc_interval) response = client.list_object_versions(Bucket=bucket_name) versions = response['Versions'] @@ -9157,7 +9165,9 @@ def test_lifecycle_expiration_tags1(): Bucket=bucket_name, LifecycleConfiguration=lifecycle_config) eq(response['ResponseMetadata']['HTTPStatusCode'], 200) - time.sleep(28) + lc_interval = get_lc_debug_interval() + + time.sleep(3*lc_interval) try: expire_objects = response['Contents'] @@ -9235,7 +9245,9 @@ def test_lifecycle_expiration_tags2(): response = setup_lifecycle_tags2(client, bucket_name) - time.sleep(28) + lc_interval = get_lc_debug_interval() + + time.sleep(3*lc_interval) response = client.list_objects(Bucket=bucket_name) expire1_objects = response['Contents'] @@ -9256,7 +9268,9 @@ def test_lifecycle_expiration_versioned_tags2(): response = setup_lifecycle_tags2(client, bucket_name) - time.sleep(28) + lc_interval = get_lc_debug_interval() + + time.sleep(3*lc_interval) response = client.list_objects(Bucket=bucket_name) expire1_objects = response['Contents'] @@ -9327,14 +9341,16 @@ def test_lifecycle_expiration_noncur_tags1(): # noncurrent version expiration at 4 "days" response = setup_lifecycle_noncur_tags(client, bucket_name, 4) + lc_interval = get_lc_debug_interval() + num_objs = verify_lifecycle_expiration_noncur_tags( - client, bucket_name, 20) + client, bucket_name, 2*lc_interval) # at T+20, 10 objects should exist eq(num_objs, 10) num_objs = verify_lifecycle_expiration_noncur_tags( - client, bucket_name, 40) + client, bucket_name, 5*lc_interval) # at T+60, only the current object version should exist eq(num_objs, 1) @@ -9448,7 +9464,10 @@ def test_lifecycle_expiration_date(): response = client.list_objects(Bucket=bucket_name) init_objects = response['Contents'] - time.sleep(20) + lc_interval = get_lc_debug_interval() + + # Wait for first expiration (plus fudge to handle the timer window) + time.sleep(3*lc_interval) response = client.list_objects(Bucket=bucket_name) expire_objects = response['Contents'] @@ -9578,7 +9597,11 @@ def test_lifecycle_noncur_expiration(): rules=[{'ID': 'rule1', 'NoncurrentVersionExpiration': {'NoncurrentDays': 2}, 'Prefix': 'test1/', 'Status':'Enabled'}] lifecycle = {'Rules': rules} client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle) - time.sleep(50) + + lc_interval = get_lc_debug_interval() + + # Wait for first expiration (plus fudge to handle the timer window) + time.sleep(5*lc_interval) response = client.list_object_versions(Bucket=bucket_name) expire_versions = response['Versions'] @@ -9644,7 +9667,11 @@ def test_lifecycle_deletemarker_expiration(): rules=[{'ID': 'rule1', 'NoncurrentVersionExpiration': {'NoncurrentDays': 1}, 'Expiration': {'ExpiredObjectDeleteMarker': True}, 'Prefix': 'test1/', 'Status':'Enabled'}] lifecycle = {'Rules': rules} client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle) - time.sleep(50) + + lc_interval = get_lc_debug_interval() + + # Wait for first expiration (plus fudge to handle the timer window) + time.sleep(5*lc_interval) response = client.list_object_versions(Bucket=bucket_name) init_versions = response['Versions'] @@ -9697,7 +9724,11 @@ def test_lifecycle_multipart_expiration(): ] lifecycle = {'Rules': rules} response = client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle) - time.sleep(50) + + lc_interval = get_lc_debug_interval() + + # Wait for first expiration (plus fudge to handle the timer window) + time.sleep(5*lc_interval) response = client.list_multipart_uploads(Bucket=bucket_name) expired_uploads = response['Uploads'] @@ -9731,7 +9762,6 @@ def _test_encryption_sse_customer_write(file_size): body = _get_body(response) eq(body, data) - @attr(resource='object') @attr(method='put') @attr(operation='Test SSE-C encrypted transfer 1 byte')