diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-07-06 16:01:32 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-07-07 15:17:14 +0000 |
commit | e9aefb62e3e2942084b3845c08d3b0362271b852 (patch) | |
tree | e40397e6916c9f88b779c5a2e3400f744751e8a5 /snaps/openstack/utils/tests | |
parent | 56ad05c9ed980a5e4c71d18bb4067519ae7efa49 (diff) |
Fix get_endpoint
One specific service type has the same endpoint url if interface is admin
or internal, while it is different from that with public interface, except
the admin and internal endpoint url for service identity has same ip but
different ports.
Change-Id: I19c260222286d8b4aa3f0d3b7d273e192b13a96b
Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'snaps/openstack/utils/tests')
-rw-r--r-- | snaps/openstack/utils/tests/keystone_utils_tests.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/snaps/openstack/utils/tests/keystone_utils_tests.py b/snaps/openstack/utils/tests/keystone_utils_tests.py index d9ff3ed..1fc9d38 100644 --- a/snaps/openstack/utils/tests/keystone_utils_tests.py +++ b/snaps/openstack/utils/tests/keystone_utils_tests.py @@ -110,7 +110,7 @@ class KeystoneUtilsTests(OSComponentTestCase): succeed. """ endpoint = keystone_utils.get_endpoint(self.os_creds, - service_type="identity") + service_type='identity') self.assertIsNotNone(endpoint) def test_get_endpoint_fail_without_proper_service(self): @@ -119,7 +119,7 @@ class KeystoneUtilsTests(OSComponentTestCase): cannot succeed. """ with self.assertRaises(Exception): - keystone_utils.get_endpoint(self.os_creds, service_type="glance") + keystone_utils.get_endpoint(self.os_creds, service_type='glance') def test_get_endpoint_fail_without_proper_credentials(self): """ @@ -132,4 +132,22 @@ class KeystoneUtilsTests(OSComponentTestCase): keystone_utils.get_endpoint( OSCreds(username='user', password='pass', auth_url='url', project_name='project'), - service_type="image") + service_type='image') + + def test_get_endpoint_with_different_interface(self): + """ + Tests to ensure that different endpoint urls are obtained with + 'public', 'internal' and 'admin' interface + """ + endpoint_public = keystone_utils.get_endpoint(self.os_creds, + service_type='image', + interface='public') + endpoint_internal = keystone_utils.get_endpoint(self.os_creds, + service_type='image', + interface='internal') + endpoint_admin = keystone_utils.get_endpoint(self.os_creds, + service_type='image', + interface='admin') + self.assertNotEqual(endpoint_public, endpoint_internal) + self.assertNotEqual(endpoint_public, endpoint_admin) + self.assertEqual(endpoint_admin, endpoint_internal) |