Skip to content

Commit 0bd17bb

Browse files
test: adjust version time to avoid future timestamp error (#538)
* test: adjust version time to avoid future timestamp error * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: use None when encryption config is empty Co-authored-by: larkee <[email protected]> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 098a786 commit 0bd17bb

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

google/cloud/spanner_v1/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def restore(self, source):
694694
parent=self._instance.name,
695695
database_id=self.database_id,
696696
backup=source.name,
697-
encryption_config=self._encryption_config,
697+
encryption_config=self._encryption_config or None,
698698
)
699699
future = api.restore_database(request=request, metadata=metadata,)
700700
return future

tests/system/test_backup_api.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,14 @@ def diff_config_instance(
7979
_helpers.scrub_instance_ignore_not_found(diff_config_instance)
8080

8181

82-
@pytest.fixture(scope="function")
83-
def database_version_time(shared_database): # Ensure database exists.
84-
return datetime.datetime.now(datetime.timezone.utc)
82+
@pytest.fixture(scope="session")
83+
def database_version_time(shared_database):
84+
shared_database.reload()
85+
diff = (
86+
datetime.datetime.now(datetime.timezone.utc)
87+
- shared_database.earliest_version_time
88+
)
89+
return shared_database.earliest_version_time + diff / 2
8590

8691

8792
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)