-
Notifications
You must be signed in to change notification settings - Fork 1
[GCP-8479] Bigtable: 'test_bigtable_list_tables' snippet flakes with '504 Deadline Exceeded'. #15
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ | |
| INSTANCE_ID = "snippet-tests" + UNIQUE_SUFFIX | ||
| CLUSTER_ID = "clus-1-" + UNIQUE_SUFFIX | ||
| APP_PROFILE_ID = "app-prof" + UNIQUE_SUFFIX | ||
| TABLE_ID = "tabl-1" + UNIQUE_SUFFIX | ||
| ROUTING_POLICY_TYPE = enums.RoutingPolicyType.ANY | ||
| LOCATION_ID = "us-central1-f" | ||
| ALT_LOCATION_ID = "us-central1-a" | ||
|
|
@@ -72,6 +73,7 @@ class Config(object): | |
|
|
||
| CLIENT = None | ||
| INSTANCE = None | ||
| TABLE = None | ||
|
|
||
|
|
||
| def setup_module(): | ||
|
|
@@ -88,6 +90,8 @@ def setup_module(): | |
| operation = Config.INSTANCE.create(clusters=[cluster]) | ||
| # We want to make sure the operation completes. | ||
| operation.result(timeout=100) | ||
| Config.TABLE = Config.INSTANCE.table(TABLE_ID) | ||
| Config.TABLE.create() | ||
|
|
||
|
|
||
| def teardown_module(): | ||
|
|
@@ -413,14 +417,6 @@ def test_bigtable_create_table(): | |
|
|
||
|
|
||
| def test_bigtable_list_tables(): | ||
| from google.cloud.bigtable import Client | ||
| from google.cloud.bigtable import column_family | ||
|
|
||
| client = Client(admin=True) | ||
| instance = client.instance(INSTANCE_ID) | ||
| table = instance.table("to_list") | ||
| max_versions_rule = column_family.MaxVersionsGCRule(2) | ||
| table.create(column_families={"cf1": max_versions_rule}) | ||
|
|
||
| # [START bigtable_list_tables] | ||
| from google.cloud.bigtable import Client | ||
|
|
@@ -430,11 +426,9 @@ def test_bigtable_list_tables(): | |
| tables_list = instance.list_tables() | ||
| # [END bigtable_list_tables] | ||
|
|
||
| # Check if returned list has expected table | ||
| table_names = [table.name for table in tables_list] | ||
| try: | ||
| assert table.name in table_names | ||
| finally: | ||
| retry_429(table.delete)() | ||
| assert Config.TABLE.name in table_names | ||
|
|
||
|
|
||
| def test_bigtable_delete_cluster(): | ||
|
|
@@ -471,9 +465,10 @@ def test_bigtable_delete_instance(): | |
|
|
||
| client = Client(admin=True) | ||
|
|
||
| instance = client.instance("inst-my-123", instance_type=PRODUCTION, labels=LABELS) | ||
| instance_id = "snipt-inst-del" + UNIQUE_SUFFIX | ||
| instance = client.instance(instance_id, instance_type=PRODUCTION, labels=LABELS) | ||
| cluster = instance.cluster( | ||
| "clus-my-123", | ||
| "clus-to-delete" + UNIQUE_SUFFIX, | ||
|
Collaborator
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. Some nit-picking, but I'd use somewhat more informative names, such as "snippet-instance", "cluster-to-delete" etc.
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. This instance is created for only 'instance delete' test, hence the names.
|
||
| location_id=ALT_LOCATION_ID, | ||
| serve_nodes=1, | ||
| default_storage_type=STORAGE_TYPE, | ||
|
|
@@ -491,7 +486,6 @@ def test_bigtable_delete_instance(): | |
|
|
||
| client = Client(admin=True) | ||
|
|
||
| instance_id = "inst-my-123" | ||
| instance_to_delete = client.instance(instance_id) | ||
| instance_to_delete.delete() | ||
| # [END bigtable_delete_instance] | ||
|
|
||
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.
Yes, not sure why this duplicate import was there before, in the first place.
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.
These are snippets which are included in doc string of actual functions, so for example codes we need to have imports for users to understand.