From 092d8bdae57bedec1805ec6a1e69fa75d328b4df Mon Sep 17 00:00:00 2001 From: Matthias Bastian Date: Thu, 12 Jul 2018 12:16:30 +0200 Subject: [PATCH] Use configured endpoint instead of hardcoded ones Usage of public endpoints was hardcoded - for the Heat client - in a test for the Zaqar client - when checking if a service is available A test also required Heat to be configured to use public endpoints when talking to services. This test is more relaxed now. Change-Id: I3784e126d28a51d990702e1b9e6bf23f0447fa21 --- heat_tempest_plugin/common/test.py | 2 +- heat_tempest_plugin/services/clients.py | 2 +- heat_tempest_plugin/tests/functional/test_remote_stack.py | 5 +++-- heat_tempest_plugin/tests/functional/test_waitcondition.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/heat_tempest_plugin/common/test.py b/heat_tempest_plugin/common/test.py index 429d4ae..34ab24e 100644 --- a/heat_tempest_plugin/common/test.py +++ b/heat_tempest_plugin/common/test.py @@ -257,7 +257,7 @@ class HeatIntegrationTest(testtools.testcase.WithAttributes, def is_service_available(self, service_type): try: self.identity_client.get_endpoint_url( - service_type, self.conf.region) + service_type, self.conf.region, self.conf.endpoint_type) except kc_exceptions.EndpointNotFound: return False else: diff --git a/heat_tempest_plugin/services/clients.py b/heat_tempest_plugin/services/clients.py index 3999cee..233c2dd 100644 --- a/heat_tempest_plugin/services/clients.py +++ b/heat_tempest_plugin/services/clients.py @@ -111,7 +111,7 @@ class ClientManager(object): self.HEATCLIENT_VERSION, endpoint, session=session, - endpoint_type='publicURL', + endpoint_type=self.conf.endpoint_type, service_type='orchestration', region_name=self.conf.region, username=self._username(), diff --git a/heat_tempest_plugin/tests/functional/test_remote_stack.py b/heat_tempest_plugin/tests/functional/test_remote_stack.py index 5e778e7..1a467f4 100644 --- a/heat_tempest_plugin/tests/functional/test_remote_stack.py +++ b/heat_tempest_plugin/tests/functional/test_remote_stack.py @@ -94,9 +94,10 @@ outputs: ex = self.assertRaises(exc.HTTPBadRequest, self.stack_create, **kwargs) error_msg = ('ERROR: Cannot establish connection to Heat endpoint ' - 'at region "DARKHOLE" due to "publicURL endpoint for ' + 'at region "DARKHOLE" due to ' + '"(?:public|internal|admin)(?:URL)? endpoint for ' 'orchestration service in DARKHOLE region not found"') - self.assertEqual(error_msg, six.text_type(ex)) + self.assertRegex(six.text_type(ex), error_msg) @decorators.idempotent_id('b2190dfc-d223-4595-b168-6c42b0f3a3e5') def test_stack_resource_validation_fail(self): diff --git a/heat_tempest_plugin/tests/functional/test_waitcondition.py b/heat_tempest_plugin/tests/functional/test_waitcondition.py index b50c0a2..c21b33b 100644 --- a/heat_tempest_plugin/tests/functional/test_waitcondition.py +++ b/heat_tempest_plugin/tests/functional/test_waitcondition.py @@ -54,7 +54,7 @@ outputs: password=signal['password'], project_id=signal['project_id']) endpoint = ks.service_catalog.url_for( - service_type='messaging', endpoint_type='publicURL') + service_type='messaging', endpoint_type=self.conf.endpoint_type) conf = { 'auth_opts': { 'backend': 'keystone',