From 02542a0353d9cb87858b840a3a9cfed9c2e902f6 Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Tue, 20 Feb 2024 12:17:32 -0500 Subject: [PATCH] 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) --- s3tests_boto3/functional/test_s3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 1be9600..11b1dd9 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -9836,7 +9836,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/') eq(check_lifecycle_expiration_header(response, now, 'rule1', 1), True) @@ -9851,7 +9851,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/') @@ -9928,7 +9928,7 @@ def test_lifecycle_expiration_header_tags_head(): @attr('lifecycle_expiration') @attr('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={