-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RDS: add OriginalSnapshotCreateTime to DB snapshots #8540
base: master
Are you sure you want to change the base?
RDS: add OriginalSnapshotCreateTime to DB snapshots #8540
Conversation
In contrast to `SnapshotCreateTime`, the `OriginalSnapshotCreateTime` does not change when the snapshot gets copied. Testing uses only 3 decimals for timestamp because the `iso_8601_datetime_with_milliseconds()` only provides 3. Skip some tests when in server mode, because `freeze_time` does not work there.
In those versions, `fromisoformat` only supports dates. But simply `fromisoformat("2025-01-02")` also fails, because the timezone is not correct when comparing.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8540 +/- ##
=======================================
Coverage 92.63% 92.63%
=======================================
Files 1229 1229
Lines 106422 106423 +1
=======================================
+ Hits 98580 98582 +2
+ Misses 7842 7841 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -1912,6 +1921,7 @@ def copy_db_snapshot( | |||
db_instance=source_snapshot.database, | |||
db_snapshot_identifier=target_snapshot_identifier, | |||
tags=tags, | |||
original_created_at=source_snapshot.original_created_at, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be orginal_created_at=source_snapshot.created_at
?
@@ -4,8 +4,10 @@ | |||
import boto3 | |||
import pytest | |||
from botocore.exceptions import ClientError | |||
from dateutil.tz import tzutc | |||
from freezegun import freeze_time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Freezing time is a pain (doesn't work in server mode, etc.) and we should really only use it when absolutely necessary. Isn't it enough to assert that OrginalSnapshotCreateTIme == SnapshotCreateTime
or SnapshotCreateTime > OriginalSnapshotCreateTime
?
In contrast to
SnapshotCreateTime
, theOriginalSnapshotCreateTime
does not change when the snapshot gets copied.Testing uses only 3 decimals for timestamp because the
iso_8601_datetime_with_milliseconds()
only provides 3. Skip some tests when in server mode, becausefreeze_time
does not work there.