Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
Add gccl metrics header to Spanner.#3045
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -59,7 +59,7 @@ | ||
| setup( | ||
| name='google-cloud-spanner', | ||
| version='0.23.1', | ||
| version='0.23.2', | ||
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page.
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page. | ||
| description='Python Client for Cloud Spanner', | ||
| long_description=README, | ||
| namespace_packages=[ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -106,6 +106,45 @@ def test_constructor_credentials_wo_create_scoped(self): | ||
| expected_scopes = None | ||
| self._constructor_test_helper(expected_scopes, creds) | ||
| def test_admin_api_lib_name(self): | ||
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page.
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page. | ||
| from google.cloud.spanner import __version__ | ||
| from google.cloud.gapic.spanner_admin_database import v1 as db | ||
| from google.cloud.gapic.spanner_admin_instance import v1 as inst | ||
| # Get the actual admin client classes. | ||
| DatabaseAdminClient = db.database_admin_client.DatabaseAdminClient | ||
| InstanceAdminClient = inst.instance_admin_client.InstanceAdminClient | ||
| # Test that the DatabaseAdminClient is called with the gccl library | ||
| # name and version. | ||
| with mock.patch.object(DatabaseAdminClient, '__init__') as mock_dac: | ||
| mock_dac.return_value = None | ||
| client = self._make_one( | ||
| credentials=_make_credentials(), | ||
| project='foo', | ||
| ) | ||
| self.assertIsInstance(client.database_admin_api, | ||
| DatabaseAdminClient) | ||
| mock_dac.assert_called_once() | ||
| self.assertEqual(mock_dac.mock_calls[0][2]['lib_name'], 'gccl') | ||
| self.assertEqual(mock_dac.mock_calls[0][2]['lib_version'], | ||
| __version__) | ||
| # Test that the InstanceAdminClient is called with the gccl library | ||
| # name and version. | ||
| with mock.patch.object(InstanceAdminClient, '__init__') as mock_iac: | ||
| mock_iac.return_value = None | ||
| client = self._make_one( | ||
| credentials=_make_credentials(), | ||
| project='foo', | ||
| ) | ||
| self.assertIsInstance(client.instance_admin_api, | ||
| InstanceAdminClient) | ||
| mock_iac.assert_called_once() | ||
| self.assertEqual(mock_iac.mock_calls[0][2]['lib_name'], 'gccl') | ||
| self.assertEqual(mock_iac.mock_calls[0][2]['lib_version'], | ||
| __version__) | ||
| def test_instance_admin_api(self): | ||
| from google.cloud._testing import _Monkey | ||
| from google.cloud.spanner import client as MUT | ||
| @@ -114,14 +153,17 @@ def test_instance_admin_api(self): | ||
| client = self._make_one(project=self.PROJECT, credentials=creds) | ||
| class _Client(object): | ||
| pass | ||
| def __init__(self, *args, **kwargs): | ||
| self.args = args | ||
| self.kwargs = kwargs | ||
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page.
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page. | ||
| with _Monkey(MUT, InstanceAdminClient=_Client): | ||
| api = client.instance_admin_api | ||
| self.assertTrue(isinstance(api, _Client)) | ||
| again = client.instance_admin_api | ||
| self.assertTrue(again is api) | ||
| self.assertEqual(api.kwargs['lib_name'], 'gccl') | ||
| def test_database_admin_api(self): | ||
| from google.cloud._testing import _Monkey | ||
| @@ -131,14 +173,17 @@ def test_database_admin_api(self): | ||
| client = self._make_one(project=self.PROJECT, credentials=creds) | ||
| class _Client(object): | ||
| pass | ||
| def __init__(self, *args, **kwargs): | ||
| self.args = args | ||
| self.kwargs = kwargs | ||
| with _Monkey(MUT, DatabaseAdminClient=_Client): | ||
| api = client.database_admin_api | ||
| self.assertTrue(isinstance(api, _Client)) | ||
| again = client.database_admin_api | ||
| self.assertTrue(again is api) | ||
| self.assertEqual(api.kwargs['lib_name'], 'gccl') | ||
| def test_copy(self): | ||
| credentials = _Credentials('value') | ||
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.