Skip to content

Commit

Permalink
Add endpoint_type config option
Browse files Browse the repository at this point in the history
Prior to their removal from the tempest repository, the heat tests
supported an endpoint_type option[1] to configure which endpoint
interface to use in its requests to the Orchestration service and other
OpenStack services. This patch adds back this support so that users can
configure the heat tests to run against non-public interfaces.

[1] http://git.openstack.org/cgit/openstack/tempest/tree/tempest/config.py?h=17.2.0#n943

Change-Id: Id86f90e428136198b4244f12da5eb53f673fd788
  • Loading branch information
cmurphy committed Dec 29, 2017
1 parent 7fa633b commit 30b1fd6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 4 additions & 0 deletions heat_tempest_plugin/config.py
Expand Up @@ -67,6 +67,10 @@
"is used"),
cfg.StrOpt('region',
help="The region name to use"),
cfg.StrOpt('endpoint_type',
default='public',
choices=['public', 'admin', 'internal'],
help="The endpoint type to use for the orchestration service."),
cfg.StrOpt('instance_type',
help="Instance type for tests. Needs to be big enough for a "
"full OS plus the test workload"),
Expand Down
19 changes: 11 additions & 8 deletions heat_tempest_plugin/services/clients.py
Expand Up @@ -47,10 +47,12 @@ def auth_ref(self):
def project_id(self):
return self.auth_plugin.get_project_id(self.session)

def get_endpoint_url(self, service_type, region=None):
def get_endpoint_url(self, service_type, region=None,
endpoint_type='public'):
kwargs = {
'service_type': service_type,
'region_name': region}
'region_name': region,
'interface': endpoint_type}
return self.auth_ref.service_catalog.url_for(**kwargs)


Expand Down Expand Up @@ -108,7 +110,8 @@ def _get_orchestration_client(self):
try:
if endpoint is None:
endpoint = self.identity_client.get_endpoint_url(
'orchestration', self.conf.region)
'orchestration', region=self.conf.region,
endpoint_type=self.conf.endpoint_type)
except kc_exceptions.EndpointNotFound:
return None
else:
Expand Down Expand Up @@ -151,7 +154,7 @@ def _get_compute_client(self):
self.NOVA_API_VERSION,
session=self.identity_client.session,
service_type='compute',
endpoint_type='publicURL',
endpoint_type=self.conf.endpoint_type,
region_name=self.conf.region,
os_cache=False,
http_log_debug=True)
Expand All @@ -162,29 +165,29 @@ def _get_network_client(self):
session=self.identity_client.session,
service_type='network',
region_name=self.conf.region,
endpoint_type='publicURL')
endpoint_type=self.conf.endpoint_type)

def _get_volume_client(self):
return cinder_client.Client(
self.CINDERCLIENT_VERSION,
session=self.identity_client.session,
endpoint_type='publicURL',
endpoint_type=self.conf.endpoint_type,
region_name=self.conf.region,
http_log_debug=True)

def _get_object_client(self):
args = {
'auth_version': self.auth_version,
'session': self.identity_client.session,
'os_options': {'endpoint_type': 'publicURL',
'os_options': {'endpoint_type': self.conf.endpoint_type,
'region_name': self.conf.region,
'service_type': 'object-store'},
}
return swift_client.Connection(**args)

def _get_metric_client(self):

adapter_options = {'interface': 'public',
adapter_options = {'interface': self.conf.endpoint_type,
'region_name': self.conf.region}
args = {
'session': self.identity_client.session,
Expand Down
2 changes: 1 addition & 1 deletion heat_tempest_plugin/tests/api/test_heat_api.py
Expand Up @@ -35,7 +35,7 @@ def load_tests(loader, tests, pattern):
return
manager = clients.ClientManager(conf)
endpoint = manager.identity_client.get_endpoint_url(
'orchestration', conf.region)
'orchestration', region=conf.region, endpoint_type=conf.endpoint_type)
host = urlparse.urlparse(endpoint).hostname
os.environ['OS_TOKEN'] = manager.identity_client.auth_token
os.environ['PREFIX'] = test.rand_name('api')
Expand Down

0 comments on commit 30b1fd6

Please sign in to comment.