mirror of
https://github.com/ceph/s3-tests.git
synced 2025-03-28 23:04:03 +00:00
s3: test that object lock can be enabled on an existing bucket
Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
parent
dc155b5c26
commit
f0854020d7
1 changed files with 29 additions and 0 deletions
|
@ -12360,6 +12360,35 @@ def test_object_lock_put_obj_lock_invalid_bucket():
|
|||
assert status == 409
|
||||
assert error_code == 'InvalidBucketState'
|
||||
|
||||
def test_object_lock_put_obj_lock_enable_after_create():
|
||||
bucket_name = get_new_bucket_name()
|
||||
client = get_client()
|
||||
client.create_bucket(Bucket=bucket_name)
|
||||
conf = {'ObjectLockEnabled':'Enabled',
|
||||
'Rule': {
|
||||
'DefaultRetention':{
|
||||
'Mode':'GOVERNANCE',
|
||||
'Days':1
|
||||
}
|
||||
}}
|
||||
|
||||
# fail if bucket is not versioned
|
||||
e = assert_raises(ClientError, client.put_object_lock_configuration, Bucket=bucket_name, ObjectLockConfiguration=conf)
|
||||
status, error_code = _get_status_and_error_code(e.response)
|
||||
assert status == 409
|
||||
assert error_code == 'InvalidBucketState'
|
||||
|
||||
# fail if versioning is suspended
|
||||
check_configure_versioning_retry(bucket_name, "Suspended", "Suspended")
|
||||
e = assert_raises(ClientError, client.put_object_lock_configuration, Bucket=bucket_name, ObjectLockConfiguration=conf)
|
||||
status, error_code = _get_status_and_error_code(e.response)
|
||||
assert status == 409
|
||||
assert error_code == 'InvalidBucketState'
|
||||
|
||||
# enable object lock if versioning is enabled
|
||||
check_configure_versioning_retry(bucket_name, "Enabled", "Enabled")
|
||||
response = client.put_object_lock_configuration(Bucket=bucket_name, ObjectLockConfiguration=conf)
|
||||
assert response['ResponseMetadata']['HTTPStatusCode'] == 200
|
||||
|
||||
@pytest.mark.fails_on_dbstore
|
||||
def test_object_lock_put_obj_lock_with_days_and_years():
|
||||
|
|
Loading…
Add table
Reference in a new issue