Browse Source

Merge "Stop trying to use identity URI if dashboard URL exists"

changes/04/787904/1
Zuul 1 year ago committed by Gerrit Code Review
parent
commit
894835caca
  1. 13
      config_tempest/services/horizon.py
  2. 12
      config_tempest/tests/services/test_horizon.py

13
config_tempest/services/horizon.py

@ -22,11 +22,14 @@ from config_tempest import constants as C
def configure_horizon(conf, **kwargs):
"""Derive the horizon URIs from the identity's URI."""
uri = conf.get('identity', 'uri')
u = urllib.parse.urlparse(uri)
base = '%s://%s%s' % (u.scheme, u.netloc.replace(
':' + str(u.port), ''), '/dashboard')
"""Verify horizon is working (fallback to introspect from identity URI)"""
if conf.has_option("dashboard", "dashboard_url"):
base = conf.get("dashboard", "dashboard_url")
else:
uri = conf.get('identity', 'uri')
u = urllib.parse.urlparse(uri)
base = '%s://%s%s' % (u.scheme, u.netloc.replace(
':' + str(u.port), ''), '/dashboard')
assert base.startswith('http:') or base.startswith('https:')
has_horizon = True
try:

12
config_tempest/tests/services/test_horizon.py

@ -28,6 +28,18 @@ class TestConfigTempest(BaseConfigTempestTest):
super(TestConfigTempest, self).setUp()
self.conf = self._get_conf("v2.0", "v3")
def test_configure_horizon_overridden(self):
mock_function = mock.Mock(return_value=True)
self.useFixture(MonkeyPatch('six.moves.urllib.request.urlopen',
mock_function))
self.conf.set("dashboard", "dashboard_url", "http://172.16.52.151")
horizon.configure_horizon(self.conf)
self.assertEqual(self.conf.get('service_available', 'horizon'), "True")
self.assertEqual(self.conf.get('dashboard', 'dashboard_url'),
"http://172.16.52.151/")
self.assertEqual(self.conf.get('dashboard', 'login_url'),
"http://172.16.52.151/auth/login/")
def test_configure_horizon_ipv4(self):
mock_function = mock.Mock(return_value=True)
self.useFixture(MonkeyPatch('six.moves.urllib.request.urlopen',

Loading…
Cancel
Save