-
Notifications
You must be signed in to change notification settings - Fork 1.8k
chore(bigtable): improve system test instance usage #18149
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
base: main
Are you sure you want to change the base?
Changes from all commits
47e4e4f
620b484
5498bd3
78d20fa
79c69e3
4af7095
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -334,23 +334,12 @@ def test_table_backup( | |
| assert restored_table in tables | ||
| restored_table.delete() | ||
|
|
||
| # Testing `Backup.restore()` into a different instance: | ||
| # Setting up another instance... | ||
| alt_instance_id = f"gcp-alt-{unique_suffix}" | ||
| alt_cluster_id = f"{alt_instance_id}-cluster" | ||
| alt_instance = admin_client.instance(alt_instance_id, labels=instance_labels) | ||
| alt_cluster = alt_instance.cluster( | ||
| cluster_id=alt_cluster_id, | ||
| location_id=location_id, | ||
| serve_nodes=1, | ||
| # Testing `Backup.restore()`: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did this change the behavior? it was testing restoring to a different instance before. Now it's just backing up to a different table? on the same instance?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is a slightly different test case now. Looking at the code, the client isn't really aware of whether the passed in is is new or old when building a request. So we're not really exercising any different client-side logic here, and it didn't feel worth consuming an extra Instance create/delete for this. But if you think this is important to cover, we can leave it as-is |
||
| restored_table_id_2 = "test-backup-table-restored-2" | ||
| restore_op = temp_backup.restore( | ||
| restored_table_id_2, data_instance_populated.instance_id | ||
| ) | ||
| create_op = alt_instance.create(clusters=[alt_cluster]) | ||
| instances_to_delete.append(alt_instance) | ||
| create_op.result(timeout=240) | ||
|
|
||
| # Testing `restore()`... | ||
| restore_op = temp_backup.restore(restored_table_id, alt_instance_id) | ||
| restore_op.result(timeout=240) | ||
| restored_table = alt_instance.table(restored_table_id) | ||
| assert restored_table in alt_instance.list_tables() | ||
| restored_table.delete() | ||
| restored_table_2 = data_instance_populated.table(restored_table_id_2) | ||
| assert restored_table_2 in data_instance_populated.list_tables() | ||
| restored_table_2.delete() | ||
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.
Are instances cleaned up properly in the tests? Over time, would this cause instances to slowly increase on the test project? and eventually we could run into SSD node or HDD node quota and will need to clean up the test project manually
Uh oh!
There was an error while loading. Please reload this page.
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.
Instances are expected to clean themselves up in a post-test step when tests are finished. But there previously were (and maybe still are, and maybe will be in the future) resource leaks in certain cases, causing instances to build up slowly in the test project over time over time.
This function is trying to identify > day old test instances, and clear them, as an extra defense against this build-up. But ideally, it shouldn't be needed