Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test case for delete-marker expiration with 'Days' tag #549

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions s3tests_boto3/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -8701,6 +8701,40 @@ def test_lifecycle_deletemarker_expiration():
assert len(total_init_versions) == 4
assert len(total_expire_versions) == 2

@pytest.mark.lifecycle
@pytest.mark.lifecycle_expiration
@pytest.mark.fails_on_aws
@pytest.mark.fails_on_dbstore
def test_lifecycle_deletemarker_expiration_with_days_tag():
bucket_name = get_new_bucket()
client = get_client()
check_configure_versioning_retry(bucket_name, "Enabled", "Enabled")
create_multiple_versions(client, bucket_name, "test1/a", 1)
client.delete_object(Bucket=bucket_name, Key="test1/a")

rules=[{'ID': 'rule1', 'NoncurrentVersionExpiration': {'NoncurrentDays': 1}, 'Expiration': {'Days': 5}, 'Prefix': 'test1/', 'Status':'Enabled'}]
lifecycle = {'Rules': rules}
client.put_bucket_lifecycle_configuration(Bucket=bucket_name, LifecycleConfiguration=lifecycle)

lc_interval = get_lc_debug_interval()

# Wait for first expiration (plus fudge to handle the timer window)
time.sleep(2*lc_interval)

response = client.list_object_versions(Bucket=bucket_name)
versions = response['Versions'] if ('Versions' in response) else []
delete_markers = response['DeleteMarkers'] if ('DeleteMarkers' in response) else []

assert len(versions) == 0
assert len(delete_markers) == 1

time.sleep(4*lc_interval)

response = client.list_object_versions(Bucket=bucket_name)
delete_markers = response['DeleteMarkers'] if ('DeleteMarkers' in response) else []

assert len(delete_markers) == 0

@pytest.mark.lifecycle
def test_lifecycle_set_multipart():
bucket_name = get_new_bucket()
Expand Down