Skip to content

Lifecycle expiration header tests fail - Midnight UTC leads to incorrect day difference #652

@aayushchouhan09

Description

@aayushchouhan09

The expiration date in the x-amz-expiration header is set to midnight (00:00) UTC of the expiration day, while start_time can be any time during the day. When you subtract these, the difference in days may be one less than expected because the expiration time is earlier (midnight) than start_time. This causes the days_to_expire check to fail even though the expiration is correct.

Below tests are failing:

FAILED s3tests_boto3/functional/test_s3.py::test_lifecycle_expiration_header_put - assert False
FAILED s3tests_boto3/functional/test_s3.py::test_lifecycle_expiration_header_head - assert False
FAILED s3tests_boto3/functional/test_s3.py::test_lifecycle_expiration_header_tags_head - assert False`

One fix is to adjust the start_time to midnight (00:00) UTC as well before doing the comparison. This aligns both times to midnight and makes the day difference calculation accurate, and the tests would pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions