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:
@@ -14,7 +14,6 @@ import os
|
|||||||
import openstack.config
|
import openstack.config
|
||||||
|
|
||||||
from keystoneauth1 import discover
|
from keystoneauth1 import discover
|
||||||
from keystoneauth1 import exceptions as _exceptions
|
|
||||||
from openstack import connection
|
from openstack import connection
|
||||||
from openstack.tests import base
|
from openstack.tests import base
|
||||||
|
|
||||||
@@ -114,8 +113,6 @@ class BaseFunctionalTest(base.TestCase):
|
|||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
self.addCleanup(cleanup)
|
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):
|
def require_service(self, service_type, min_microversion=None, **kwargs):
|
||||||
"""Method to check whether a service exists
|
"""Method to check whether a service exists
|
||||||
|
|
||||||
@@ -128,16 +125,16 @@ class BaseFunctionalTest(base.TestCase):
|
|||||||
|
|
||||||
:returns: True if the service exists, otherwise False.
|
:returns: True if the service exists, otherwise False.
|
||||||
"""
|
"""
|
||||||
try:
|
if not self.conn.has_service(service_type):
|
||||||
data = self.conn.session.get_endpoint_data(
|
|
||||||
service_type=service_type, **kwargs)
|
|
||||||
except _exceptions.EndpointNotFound:
|
|
||||||
self.skipTest('Service {service_type} not found in cloud'.format(
|
self.skipTest('Service {service_type} not found in cloud'.format(
|
||||||
service_type=service_type))
|
service_type=service_type))
|
||||||
|
|
||||||
if not min_microversion:
|
if not min_microversion:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
data = self.conn.session.get_endpoint_data(
|
||||||
|
service_type=service_type, **kwargs)
|
||||||
|
|
||||||
if not (data.min_microversion
|
if not (data.min_microversion
|
||||||
and data.max_microversion
|
and data.max_microversion
|
||||||
and discover.version_between(
|
and discover.version_between(
|
||||||
|
Reference in New Issue
Block a user