]> git.apps.os.sepia.ceph.com Git - s3-tests.git/commitdiff
replace datetime.now with datetime.utcnow()
authorAli Maredia <amaredia@redhat.com>
Tue, 20 Feb 2024 17:17:32 +0000 (12:17 -0500)
committerAli Maredia <amaredia@redhat.com>
Wed, 21 Feb 2024 17:29:58 +0000 (12:29 -0500)
when the local timezone is not UTC and if it is a day behind,
lifecycle_header tests fails with 2 days not equal to 1
so replacing datetime.now() with datetime.utcnow()

Signed-off-by: Ali Maredia <amaredia@redhat.com>
(cherry picked from commit 4744808eda28efca75b180c5d5ef1a5ebf24043f)

s3tests_boto3/functional/test_s3.py

index f7dcfc29d2040ea347c5640ac968fb0133ba761f..f305d3ba1ba50172ec8a9e094c1fd50b896b180a 100644 (file)
@@ -8475,7 +8475,7 @@ def test_lifecycle_expiration_header_put():
     bucket_name = get_new_bucket()
     client = get_client()
 
-    now = datetime.datetime.now(None)
+    now = datetime.datetime.utcnow()
     response = setup_lifecycle_expiration(
         client, bucket_name, 'rule1', 1, 'days1/')
     assert check_lifecycle_expiration_header(response, now, 'rule1', 1)
@@ -8487,7 +8487,7 @@ def test_lifecycle_expiration_header_head():
     bucket_name = get_new_bucket()
     client = get_client()
 
-    now = datetime.datetime.now(None)
+    now = datetime.datetime.utcnow()
     response = setup_lifecycle_expiration(
         client, bucket_name, 'rule1', 1, 'days1/')
 
@@ -8558,7 +8558,7 @@ def test_lifecycle_expiration_header_tags_head():
 @pytest.mark.lifecycle_expiration
 @pytest.mark.fails_on_dbstore
 def test_lifecycle_expiration_header_and_tags_head():
-    now = datetime.datetime.now(None)
+    now = datetime.datetime.utcnow()
     bucket_name = get_new_bucket()
     client = get_client()
     lifecycle={