Skip to content

Commit e5f618a

Browse files
committed
run generation for google-cloud-spanner
1 parent b4e84fd commit e5f618a

4 files changed

Lines changed: 42 additions & 43 deletions

File tree

.librarian/generator-input/client-post-processing/spanner-integration.yaml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,42 @@ replacements:
9292
after: |
9393
\g<1> metrics_interceptor=mock.ANY,
9494
count: 1
95-
95+
# Temporary patch until gapic-generator 1.38 or newer is released.
96+
# From https://github.com/googleapis/google-cloud-python/pull/17838
97+
- paths:
98+
- packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py
99+
- packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py
100+
- packages/google-cloud-spanner/tests/unit/gapic/spanner_v1/test_spanner.py
101+
before: |
102+
for config_data, expected_cert_source in test_cases:
103+
\ env = os.environ.copy\(\)
104+
\ env.pop\("GOOGLE_API_USE_CLIENT_CERTIFICATE", None\)
105+
\ with mock.patch.dict\(os.environ, env, clear=True\):
106+
after: |
107+
for config_data, expected_cert_source in test_cases:
108+
env = os.environ.copy()
109+
env.pop("GOOGLE_API_USE_CLIENT_CERTIFICATE", None)
110+
env.pop("CLOUDSDK_CONTEXT_AWARE_USE_CLIENT_CERTIFICATE", None)
111+
with mock.patch.dict(os.environ, env, clear=True):
112+
count: 3
113+
# Temporary patch until gapic-generator 1.38 or newer is released.
114+
# From https://github.com/googleapis/google-cloud-python/pull/17838
115+
- paths:
116+
- packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py
117+
- packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py
118+
- packages/google-cloud-spanner/tests/unit/gapic/spanner_v1/test_spanner.py
119+
before: |
120+
for config_data, expected_cert_source in test_cases:
121+
\ env = os.environ.copy\(\)
122+
\ env.pop\("GOOGLE_API_USE_CLIENT_CERTIFICATE", ""\)
123+
\ with mock.patch.dict\(os.environ, env, clear=True\):
124+
after: |
125+
for config_data, expected_cert_source in test_cases:
126+
env = os.environ.copy()
127+
env.pop("GOOGLE_API_USE_CLIENT_CERTIFICATE", "")
128+
env.pop("CLOUDSDK_CONTEXT_AWARE_USE_CLIENT_CERTIFICATE", "")
129+
with mock.patch.dict(os.environ, env, clear=True):
130+
count: 3
96131
- paths:
97132
- packages/google-cloud-spanner/tests/unit/gapic/spanner_v1/test_spanner.py
98133
# Group 1: Captures ONLY the spaces/tabs before the text

packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,25 +1057,13 @@ def test_database_admin_client_get_mtls_endpoint_and_cert_source(client_class):
10571057
assert cert_source is expected_cert_source
10581058

10591059
# Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never".
1060-
with mock.patch.dict(
1061-
os.environ,
1062-
{
1063-
"GOOGLE_API_USE_MTLS_ENDPOINT": "never",
1064-
"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false",
1065-
},
1066-
):
1060+
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
10671061
api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source()
10681062
assert api_endpoint == client_class.DEFAULT_ENDPOINT
10691063
assert cert_source is None
10701064

10711065
# Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always".
1072-
with mock.patch.dict(
1073-
os.environ,
1074-
{
1075-
"GOOGLE_API_USE_MTLS_ENDPOINT": "always",
1076-
"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false",
1077-
},
1078-
):
1066+
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
10791067
api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source()
10801068
assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT
10811069
assert cert_source is None

packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,25 +1043,13 @@ def test_instance_admin_client_get_mtls_endpoint_and_cert_source(client_class):
10431043
assert cert_source is expected_cert_source
10441044

10451045
# Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never".
1046-
with mock.patch.dict(
1047-
os.environ,
1048-
{
1049-
"GOOGLE_API_USE_MTLS_ENDPOINT": "never",
1050-
"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false",
1051-
},
1052-
):
1046+
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
10531047
api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source()
10541048
assert api_endpoint == client_class.DEFAULT_ENDPOINT
10551049
assert cert_source is None
10561050

10571051
# Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always".
1058-
with mock.patch.dict(
1059-
os.environ,
1060-
{
1061-
"GOOGLE_API_USE_MTLS_ENDPOINT": "always",
1062-
"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false",
1063-
},
1064-
):
1052+
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
10651053
api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source()
10661054
assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT
10671055
assert cert_source is None

packages/google-cloud-spanner/tests/unit/gapic/spanner_v1/test_spanner.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,25 +1004,13 @@ def test_spanner_client_get_mtls_endpoint_and_cert_source(client_class):
10041004
assert cert_source is expected_cert_source
10051005

10061006
# Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never".
1007-
with mock.patch.dict(
1008-
os.environ,
1009-
{
1010-
"GOOGLE_API_USE_MTLS_ENDPOINT": "never",
1011-
"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false",
1012-
},
1013-
):
1007+
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}):
10141008
api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source()
10151009
assert api_endpoint == client_class.DEFAULT_ENDPOINT
10161010
assert cert_source is None
10171011

10181012
# Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always".
1019-
with mock.patch.dict(
1020-
os.environ,
1021-
{
1022-
"GOOGLE_API_USE_MTLS_ENDPOINT": "always",
1023-
"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false",
1024-
},
1025-
):
1013+
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}):
10261014
api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source()
10271015
assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT
10281016
assert cert_source is None

0 commit comments

Comments
 (0)