diff options
| author | Derrick J. Wippler <thrawn01@gmail.com> | 2015-08-19 15:48:27 -0500 |
|---|---|---|
| committer | Derrick J. Wippler <thrawn01@gmail.com> | 2015-09-14 08:49:14 -0500 |
| commit | e8274fa57df3a833f8e46be2e9a6feff366e4b5c (patch) | |
| tree | d012545375845d9a08d95909c50a2ed4927f26c8 /cinderclient/tests/unit/test_shell.py | |
| parent | 50758ba475e7a8d7783d511b9b161899c41641b5 (diff) | |
| download | python-cinderclient-e8274fa57df3a833f8e46be2e9a6feff366e4b5c.tar.gz | |
No longer ignores CINDER_SERVICE_NAME
Cinderclient now utilizes the CINDER_SERVICE_NAME when deciding what
endpoint to choose.
Closes-Bug: #1486256
Change-Id: I494a34afe5799e7832b1359b9c24c31ead68b6d1
UpgradeImpact: Existing configurations may select a different endpoint
after this patch.
Diffstat (limited to 'cinderclient/tests/unit/test_shell.py')
| -rw-r--r-- | cinderclient/tests/unit/test_shell.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py index 3407a26..af6d1fa 100644 --- a/cinderclient/tests/unit/test_shell.py +++ b/cinderclient/tests/unit/test_shell.py @@ -122,6 +122,25 @@ class ShellTest(utils.TestCase): self.assertEqual(v3_url, os_auth_url, "Expected v3 url") self.assertIsNone(v2_url, "Expected no v2 url") + @requests_mock.Mocker() + def list_volumes_on_service(self, count, mocker): + os_auth_url = "http://multiple.service.names/v2.0" + mocker.register_uri('POST', os_auth_url + "/tokens", + text=keystone_client.keystone_request_callback) + mocker.register_uri('GET', + "http://cinder%i.api.com/v2/volumes/detail" + % count, text='{"volumes": []}') + self.make_env(include={'OS_AUTH_URL': os_auth_url, + 'CINDER_SERVICE_NAME': 'cinder%i' % count}) + _shell = shell.OpenStackCinderShell() + _shell.main(['list']) + + def test_cinder_service_name(self): + # Failing with 'No mock address' means we are not + # choosing the correct endpoint + for count in range(1, 4): + self.list_volumes_on_service(count) + @mock.patch('keystoneclient.adapter.Adapter.get_token', side_effect=ks_exc.ConnectionRefused()) @mock.patch('keystoneclient.discover.Discover', |
