Use has_service in functional test's require_service
Under the covers we want to use has_service, which respects the overall sdk infrastructure for skipping unnecessary discovery. Change-Id: Ib47bdc98ffa63ec70b89169574cb03057beecb42
This commit is contained in:
parent
8b85e8c954
commit
5e927dce69
@ -14,7 +14,6 @@ import os
|
||||
import openstack.config
|
||||
|
||||
from keystoneauth1 import discover
|
||||
from keystoneauth1 import exceptions as _exceptions
|
||||
from openstack import connection
|
||||
from openstack.tests import base
|
||||
|
||||
@ -114,8 +113,6 @@ class BaseFunctionalTest(base.TestCase):
|
||||
self.assertIsNone(result)
|
||||
self.addCleanup(cleanup)
|
||||
|
||||
# TODO(shade) Replace this with call to conn.has_service when we've merged
|
||||
# the shade methods into Connection.
|
||||
def require_service(self, service_type, min_microversion=None, **kwargs):
|
||||
"""Method to check whether a service exists
|
||||
|
||||
@ -128,16 +125,16 @@ class BaseFunctionalTest(base.TestCase):
|
||||
|
||||
:returns: True if the service exists, otherwise False.
|
||||
"""
|
||||
try:
|
||||
data = self.conn.session.get_endpoint_data(
|
||||
service_type=service_type, **kwargs)
|
||||
except _exceptions.EndpointNotFound:
|
||||
if not self.conn.has_service(service_type):
|
||||
self.skipTest('Service {service_type} not found in cloud'.format(
|
||||
service_type=service_type))
|
||||
|
||||
if not min_microversion:
|
||||
return
|
||||
|
||||
data = self.conn.session.get_endpoint_data(
|
||||
service_type=service_type, **kwargs)
|
||||
|
||||
if not (data.min_microversion
|
||||
and data.max_microversion
|
||||
and discover.version_between(
|
||||
|
Loading…
Reference in New Issue
Block a user