Browse Source

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

changes/04/787904/1
Zuul 4 weeks ago
committed by Gerrit Code Review
parent
commit
894835caca
2 changed files with 20 additions and 5 deletions
  1. +8
    -5
      config_tempest/services/horizon.py
  2. +12
    -0
      config_tempest/tests/services/test_horizon.py

+ 8
- 5
config_tempest/services/horizon.py View File

@ -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
- 0
config_tempest/tests/services/test_horizon.py View File

@ -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