Run functional tests when no ceilometer endpoint

Currently if there is no metering endpoint in the service
catalog then no functional/integration tests can be done.

This change tolerates missing ceilometer endpoint.

Change-Id: I55d45048284c4e78b9a1a94a35ef3cddc7bc3a37
This commit is contained in:
Steve Baker
2015-05-26 13:28:28 +12:00
parent 022a863284
commit d0e5cad7f3

View File

@@ -144,22 +144,26 @@ class ClientManager(object):
dscv = self.conf.disable_ssl_certificate_validation dscv = self.conf.disable_ssl_certificate_validation
keystone = self._get_identity_client() keystone = self._get_identity_client()
endpoint = keystone.service_catalog.url_for( try:
attr='region', endpoint = keystone.service_catalog.url_for(
filter_value=self.conf.region, attr='region',
service_type='metering', filter_value=self.conf.region,
endpoint_type='publicURL') service_type='metering',
endpoint_type='publicURL')
args = { except keystoneclient.exceptions.EndpointNotFound:
'username': self.conf.username, return None
'password': self.conf.password, else:
'tenant_name': self.conf.tenant_name, args = {
'auth_url': self.conf.auth_url, 'username': self.conf.username,
'insecure': dscv, 'password': self.conf.password,
'region_name': self.conf.region, 'tenant_name': self.conf.tenant_name,
'endpoint_type': 'publicURL', 'auth_url': self.conf.auth_url,
'service_type': 'metering', 'insecure': dscv,
} 'region_name': self.conf.region,
'endpoint_type': 'publicURL',
'service_type': 'metering',
}
return ceilometerclient.client.Client(self.CEILOMETER_VERSION, return ceilometerclient.client.Client(self.CEILOMETER_VERSION,
endpoint, **args) endpoint, **args)