From: Ali Maredia Date: Tue, 20 Feb 2024 17:17:32 +0000 (-0500) Subject: replace datetime.now with datetime.utcnow() X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d4e76db4cff40c2fbbf9fe5ea2424f8b53e53e45;p=s3-tests.git replace datetime.now with datetime.utcnow() 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 (cherry picked from commit 4744808eda28efca75b180c5d5ef1a5ebf24043f) --- diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index db04ddb6..568aae99 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -8307,7 +8307,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) @@ -8319,7 +8319,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/') @@ -8390,7 +8390,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={