Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

snordhausen
Copy link
Contributor

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 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.
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.63%. Comparing base (024067f) to head (67f1dd9).

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     
Flag Coverage Δ
servertests 27.92% <0.00%> (-0.01%) ⬇️
unittests 92.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -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,
Copy link
Collaborator

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
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants