|
56 | 56 |
|
57 | 57 | CREATE_INSTANCE = os.getenv("GOOGLE_CLOUD_TESTS_CREATE_SPANNER_INSTANCE") is not None
|
58 | 58 | USE_EMULATOR = os.getenv("SPANNER_EMULATOR_HOST") is not None
|
59 |
| -USE_RESOURCE_ROUTING = ( |
60 |
| - os.getenv("GOOGLE_CLOUD_SPANNER_ENABLE_RESOURCE_BASED_ROUTING") == "true" |
61 |
| -) |
62 | 59 |
|
63 | 60 | if CREATE_INSTANCE:
|
64 | 61 | INSTANCE_ID = "google-cloud" + unique_resource_id("-")
|
@@ -286,61 +283,6 @@ def tearDown(self):
|
286 | 283 | for doomed in self.to_delete:
|
287 | 284 | doomed.drop()
|
288 | 285 |
|
289 |
| - @unittest.skipUnless(USE_RESOURCE_ROUTING, "requires enabling resource routing") |
290 |
| - def test_spanner_api_use_user_specified_endpoint(self): |
291 |
| - # Clear cache. |
292 |
| - Client._endpoint_cache = {} |
293 |
| - api = Config.CLIENT.instance_admin_api |
294 |
| - resp = api.get_instance( |
295 |
| - Config.INSTANCE.name, field_mask={"paths": ["endpoint_uris"]} |
296 |
| - ) |
297 |
| - if not resp or not resp.endpoint_uris: |
298 |
| - return # no resolved endpoint. |
299 |
| - resolved_endpoint = resp.endpoint_uris[0] |
300 |
| - |
301 |
| - client = Client(client_options={"api_endpoint": resolved_endpoint}) |
302 |
| - |
303 |
| - instance = client.instance(Config.INSTANCE.instance_id) |
304 |
| - temp_db_id = "temp_db" + unique_resource_id("_") |
305 |
| - temp_db = instance.database(temp_db_id) |
306 |
| - temp_db.spanner_api |
307 |
| - |
308 |
| - # No endpoint cache - Default endpoint used. |
309 |
| - self.assertEqual(client._endpoint_cache, {}) |
310 |
| - |
311 |
| - @unittest.skipUnless(USE_RESOURCE_ROUTING, "requires enabling resource routing") |
312 |
| - def test_spanner_api_use_resolved_endpoint(self): |
313 |
| - # Clear cache. |
314 |
| - Client._endpoint_cache = {} |
315 |
| - api = Config.CLIENT.instance_admin_api |
316 |
| - resp = api.get_instance( |
317 |
| - Config.INSTANCE.name, field_mask={"paths": ["endpoint_uris"]} |
318 |
| - ) |
319 |
| - if not resp or not resp.endpoint_uris: |
320 |
| - return # no resolved endpoint. |
321 |
| - resolved_endpoint = resp.endpoint_uris[0] |
322 |
| - |
323 |
| - client = Client( |
324 |
| - client_options=Config.CLIENT._client_options |
325 |
| - ) # Use same endpoint as main client. |
326 |
| - |
327 |
| - instance = client.instance(Config.INSTANCE.instance_id) |
328 |
| - temp_db_id = "temp_db" + unique_resource_id("_") |
329 |
| - temp_db = instance.database(temp_db_id) |
330 |
| - temp_db.spanner_api |
331 |
| - |
332 |
| - # Endpoint is cached - resolved endpoint used. |
333 |
| - self.assertIn(Config.INSTANCE.name, client._endpoint_cache) |
334 |
| - self.assertEqual( |
335 |
| - client._endpoint_cache[Config.INSTANCE.name], resolved_endpoint |
336 |
| - ) |
337 |
| - |
338 |
| - # Endpoint is cached at a class level. |
339 |
| - self.assertIn(Config.INSTANCE.name, Config.CLIENT._endpoint_cache) |
340 |
| - self.assertEqual( |
341 |
| - Config.CLIENT._endpoint_cache[Config.INSTANCE.name], resolved_endpoint |
342 |
| - ) |
343 |
| - |
344 | 286 | def test_list_databases(self):
|
345 | 287 | # Since `Config.INSTANCE` is newly created in `setUpModule`, the
|
346 | 288 | # database created in `setUpClass` here will be the only one.
|
|
0 commit comments