Lifecycle expiration header tests fail - Midnight UTC leads to incorrect day difference
- Dominant language
- Python
- Stars
- 372
- Forks
- 328
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.