Skip to content

Commit 042f8b8

Browse files
committed
tests: check / retry 'instance.exists' before creating database
Closes #390.
1 parent bd84a4d commit 042f8b8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

samples/samples/quickstart_test.py

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from google.cloud import spanner
1919
import mock
2020
import pytest
21+
from test_utils.retry import RetryResult
2122

2223
import quickstart
2324
from snippets_test import cleanup_old_instances
@@ -71,6 +72,11 @@ def new_instance(self, unused_instance_name):
7172
def example_database():
7273
spanner_client = spanner.Client()
7374
instance = spanner_client.instance(INSTANCE_ID)
75+
76+
# Ensure that instance has propagated after creation
77+
retry = RetryResult(bool)
78+
retry(instance.exists)()
79+
7480
database = instance.database("my-database-id")
7581

7682
if not database.exists():

0 commit comments

Comments
 (0)