Skip to content

Commit aec1073

Browse files
authored
fix(google-cloud-spanner): address compatibility issues with spanner experimental (#16593)
Compatibility with experimental host broke post the major refactor in https://github.com/googleapis/python-spanner/pull/1509/changes. These minor changes fixed the compatibility. Verified with below integration tests run Integration test successful: ``` export SPANNER_EXPERIMENTAL_HOST=localhost:15000 python -m pytest -v -s --disable-warnings tests/system/ ```
1 parent 10c41fa commit aec1073

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

packages/google-cloud-spanner/google/cloud/spanner_v1/_async/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ def __init__(
313313
self._client_certificate = client_certificate
314314
self._client_key = client_key
315315
credentials = AnonymousCredentials()
316+
disable_builtin_metrics = True
316317
elif isinstance(credentials, AnonymousCredentials):
317318
self._emulator_host = self._client_options.api_endpoint
318319

@@ -645,6 +646,7 @@ def instance(
645646
self._emulator_host,
646647
labels,
647648
processing_units,
649+
self._experimental_host,
648650
)
649651

650652
@CrossSync.convert

packages/google-cloud-spanner/google/cloud/spanner_v1/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def __init__(
276276
self._client_certificate = client_certificate
277277
self._client_key = client_key
278278
credentials = AnonymousCredentials()
279+
disable_builtin_metrics = True
279280
elif isinstance(credentials, AnonymousCredentials):
280281
self._emulator_host = self._client_options.api_endpoint
281282
super(Client, self).__init__(
@@ -547,6 +548,7 @@ def instance(
547548
self._emulator_host,
548549
labels,
549550
processing_units,
551+
self._experimental_host,
550552
)
551553

552554
def list_instances(self, filter_="", page_size=None):

packages/google-cloud-spanner/tests/system/_async/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ def spanner_client():
3535

3636
credentials = AnonymousCredentials()
3737
return spanner_v1.AsyncClient(
38-
project=_helpers.EXPERIMENTAL_HOST_PROJECT,
38+
use_plain_text=_helpers.USE_PLAIN_TEXT,
39+
ca_certificate=_helpers.CA_CERTIFICATE,
40+
client_certificate=_helpers.CLIENT_CERTIFICATE,
41+
client_key=_helpers.CLIENT_KEY,
3942
credentials=credentials,
4043
experimental_host=_helpers.EXPERIMENTAL_HOST,
4144
)

0 commit comments

Comments
 (0)