From 8a47b981b9651706f1211912a81fb70379249869 Mon Sep 17 00:00:00 2001 From: David Ames Date: Thu, 6 Aug 2020 23:06:01 +0000 Subject: [PATCH 1/3] Tell horizon to use the "defaul" region SAML Mellon tests have been broken on Focal. The handling of the region selection behaves differently from bionic. Or it may be that bionic accidentally was working by seeing a string as int 0. Horizon has a "default" region which returns the keystone URL. --- zaza/openstack/charm_tests/saml_mellon/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/saml_mellon/tests.py b/zaza/openstack/charm_tests/saml_mellon/tests.py index 28ceb4e..f0f5d18 100644 --- a/zaza/openstack/charm_tests/saml_mellon/tests.py +++ b/zaza/openstack/charm_tests/saml_mellon/tests.py @@ -93,7 +93,7 @@ class CharmKeystoneSAMLMellonTest(BaseKeystoneTest): proto = "http" url = "{}://{}/horizon/auth/login/".format(proto, horizon_ip) - region = "{}://{}:5000/v3".format(proto, keystone_ip) + region = "default" horizon_expect = ('') From c498b358527a7bdacbfeeb5494af57407c74a402 Mon Sep 17 00:00:00 2001 From: David Ames Date: Thu, 6 Aug 2020 23:16:11 +0000 Subject: [PATCH 2/3] Lint fix --- zaza/openstack/charm_tests/saml_mellon/tests.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/zaza/openstack/charm_tests/saml_mellon/tests.py b/zaza/openstack/charm_tests/saml_mellon/tests.py index f0f5d18..7bb0abc 100644 --- a/zaza/openstack/charm_tests/saml_mellon/tests.py +++ b/zaza/openstack/charm_tests/saml_mellon/tests.py @@ -72,12 +72,6 @@ class CharmKeystoneSAMLMellonTest(BaseKeystoneTest): def test_saml_mellon_redirects(self): """Validate the horizon -> keystone -> IDP redirects.""" - if self.vip: - keystone_ip = self.vip - else: - unit = zaza.model.get_units(self.application_name)[0] - keystone_ip = unit.public_address - horizon = "openstack-dashboard" horizon_vip = (zaza.model.get_application_config(horizon) .get("vip").get("value")) From 7d4d40700aecbb5ed5aaa6f69f766eb0a00e7558 Mon Sep 17 00:00:00 2001 From: David Ames Date: Fri, 7 Aug 2020 01:12:37 +0000 Subject: [PATCH 3/3] Region is different for before and after Focal For the Horizon region setting use the Keystone URL prior to Focal and "default" thereafter. --- zaza/openstack/charm_tests/saml_mellon/tests.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/saml_mellon/tests.py b/zaza/openstack/charm_tests/saml_mellon/tests.py index 7bb0abc..9b5b211 100644 --- a/zaza/openstack/charm_tests/saml_mellon/tests.py +++ b/zaza/openstack/charm_tests/saml_mellon/tests.py @@ -21,6 +21,7 @@ import requests import zaza.model from zaza.openstack.charm_tests.keystone import BaseKeystoneTest import zaza.charm_lifecycle.utils as lifecycle_utils +import zaza.openstack.utilities.openstack as openstack_utils class FailedToReachIDP(Exception): @@ -42,6 +43,8 @@ class CharmKeystoneSAMLMellonTest(BaseKeystoneTest): cls.test_config = lifecycle_utils.get_charm_config() cls.application_name = cls.test_config['charm_name'] cls.action = "get-sp-metadata" + cls.current_release = openstack_utils.get_os_release() + cls.FOCAL_USSURI = openstack_utils.get_os_release("focal_ussuri") def test_run_get_sp_metadata_action(self): """Validate the get-sp-metadata action.""" @@ -72,6 +75,12 @@ class CharmKeystoneSAMLMellonTest(BaseKeystoneTest): def test_saml_mellon_redirects(self): """Validate the horizon -> keystone -> IDP redirects.""" + if self.vip: + keystone_ip = self.vip + else: + unit = zaza.model.get_units(self.application_name)[0] + keystone_ip = unit.public_address + horizon = "openstack-dashboard" horizon_vip = (zaza.model.get_application_config(horizon) .get("vip").get("value")) @@ -86,8 +95,13 @@ class CharmKeystoneSAMLMellonTest(BaseKeystoneTest): else: proto = "http" + # Use Keystone URL for < Focal + if self.current_release < self.FOCAL_USSURI: + region = "{}://{}:5000/v3".format(proto, keystone_ip) + else: + region = "default" + url = "{}://{}/horizon/auth/login/".format(proto, horizon_ip) - region = "default" horizon_expect = ('')