Skip to content

Commit

Permalink
test: adjust version time to avoid future timestamp error (#538)
Browse files Browse the repository at this point in the history
* 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 <larkee@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 26, 2021
1 parent 098a786 commit 0bd17bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion google/cloud/spanner_v1/database.py
Expand Up @@ -694,7 +694,7 @@ def restore(self, source):
parent=self._instance.name,
database_id=self.database_id,
backup=source.name,
encryption_config=self._encryption_config,
encryption_config=self._encryption_config or None,
)
future = api.restore_database(request=request, metadata=metadata,)
return future
Expand Down
11 changes: 8 additions & 3 deletions tests/system/test_backup_api.py
Expand Up @@ -79,9 +79,14 @@ def diff_config_instance(
_helpers.scrub_instance_ignore_not_found(diff_config_instance)


@pytest.fixture(scope="function")
def database_version_time(shared_database): # Ensure database exists.
return datetime.datetime.now(datetime.timezone.utc)
@pytest.fixture(scope="session")
def database_version_time(shared_database):
shared_database.reload()
diff = (
datetime.datetime.now(datetime.timezone.utc)
- shared_database.earliest_version_time
)
return shared_database.earliest_version_time + diff / 2


@pytest.fixture(scope="session")
Expand Down

0 comments on commit 0bd17bb

Please sign in to comment.