Skip to content

feat: add support for spanner copy backup feature #600

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

Merged
merged 13 commits into from
Mar 25, 2022
Prev Previous commit
Next Next commit
changes to test case
  • Loading branch information
asthamohta committed Sep 29, 2021
commit d69a889818bf6aa3e49a4e58a760feb0207e748c
19 changes: 13 additions & 6 deletions tests/system/test_backup_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ def test_copy_backup_workflow(
backups_to_delete.append(copy_backup)

# Check metadata.
metadata = operation.metadata
assert copy_backup.name == metadata.name
# metadata = operation.metadata
# assert copy_backup.name == metadata.name
operation.result() # blocks indefinitely

# Check backup object.
Expand Down Expand Up @@ -363,7 +363,9 @@ def test_backup_create_w_invalid_version_time_future(
op.result() # blocks indefinitely


def test_copy_backup_create_w_invalid_expire_time(shared_instance, shared_database):
def test_copy_backup_create_w_invalid_expire_time(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: prefer to include this case in test_copy_backup_workflow in order to reuse the created source backup and minimize the number of created backups.

shared_instance, shared_database, backups_to_delete,
):
backup_id = _helpers.unique_id("backup_id", separator="_")
source_backup_id = _helpers.unique_id("source_backup_id", separator="_")
valid_expire_time = datetime.datetime.now(
Expand All @@ -376,14 +378,19 @@ def test_copy_backup_create_w_invalid_expire_time(shared_instance, shared_databa
)
op = source_backup.create()
op.result() # blocks indefinitely
backups_to_delete.append(source_backup)

copy_backup = shared_instance.copy_backup(
backup_id, source_backup_id, expire_time=invalid_expire_time
backup_id=backup_id,
source_backup=source_backup.name,
expire_time=invalid_expire_time,
)

with pytest.raises(exceptions.InvalidArgument):
op = copy_backup.create()
op.result() # blocks indefinitely
operation = copy_backup.create()
operation.result() # blocks indefinitely

source_backup.delete()


def test_database_restore_to_diff_instance(
Expand Down