Merge "Fix identity URL parsing"

This commit is contained in:
Zuul 2018-07-23 13:25:39 +00:00 committed by Gerrit Code Review
commit ebbb91571e
2 changed files with 14 additions and 2 deletions

View File

@ -136,7 +136,7 @@ class Services(object):
C.LOG.info("Service %s has no endpoints", name)
else:
url = ep[self.public_url]
if 'identity' in url:
if 'identity' in urllib.parse.urlparse(url).path:
url = self.edit_identity_url(ep[self.public_url])
return url
@ -147,7 +147,6 @@ class Services(object):
:type url: string
:rtype: string
"""
# self._clients.auth_provider.auth_url stores identity.uri(_v3) value
# from TempestConf
port = urllib.parse.urlparse(self._clients.auth_provider.auth_url).port

View File

@ -106,6 +106,19 @@ class TestServices(BaseConfigTempestTest):
url = services.parse_endpoints(ep, 'ServiceName')
self.assertEqual('https://10.0.0.101:13000/identity/v2', url)
def test_parse_endpoints_not_ip_hostname(self):
services = self._create_services_instance()
services.public_url = "url"
url = "https://identity-my.cloud.com:35456/v2.0"
ep = {
'url': url,
'interface': 'public',
'region': 'regioneOne',
}
services._clients.auth_provider.auth_url = "35456"
url_resp = services.parse_endpoints(ep, "ServiceName")
self.assertEqual(url, url_resp)
def test_edit_identity_url(self):
services = self._create_services_instance()
url_port = 'https://10.0.0.101:13000/v2.0'