]> git.apps.os.sepia.ceph.com Git - s3-tests.git/commitdiff
object lock: test very large RetainUntilDate
authorCasey Bodley <cbodley@redhat.com>
Wed, 15 Nov 2023 21:31:52 +0000 (16:31 -0500)
committerCasey Bodley <cbodley@redhat.com>
Tue, 28 Nov 2023 20:54:35 +0000 (15:54 -0500)
https://tracker.ceph.com/issues/63537 reported that large dates (with
year after 2107) got truncated when written. test with a later date, and
check that get_object_retention() gives back the date we put

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 40182ce26f3363487bc9b31aaa55538b1e7f10a6)

s3tests_boto3/functional/test_s3.py

index 5521668675405f8804fe4efc729edaf6703aa11b..5b03947f900a94083eeddea338e8df5c64878fa5 100644 (file)
@@ -11839,9 +11839,11 @@ def test_object_lock_put_obj_retention():
     key = 'file1'
     response = client.put_object(Bucket=bucket_name, Body='abc', Key=key)
     version_id = response['VersionId']
-    retention = {'Mode':'GOVERNANCE', 'RetainUntilDate':datetime.datetime(2030,1,1,tzinfo=pytz.UTC)}
+    retention = {'Mode':'GOVERNANCE', 'RetainUntilDate':datetime.datetime(2140,1,1,tzinfo=pytz.UTC)}
     response = client.put_object_retention(Bucket=bucket_name, Key=key, Retention=retention)
     assert response['ResponseMetadata']['HTTPStatusCode'] == 200
+    response = client.get_object_retention(Bucket=bucket_name, Key=key)
+    assert response['Retention'] == retention
     client.delete_object(Bucket=bucket_name, Key=key, VersionId=version_id, BypassGovernanceRetention=True)