check is_admin_available for force_tenant_isolation in test.py
If force_tenant_isolation is set to True, admin credential is
needed, and this check should be put in skip_checks in test.py,
while should not be done by individual testcases.
Change-Id: I9506120a088cde270b9c787bab26bf6e4c4a23d3
diff --git a/tempest/api/compute/admin/test_auto_allocate_network.py b/tempest/api/compute/admin/test_auto_allocate_network.py
index ea92563..0c80252 100644
--- a/tempest/api/compute/admin/test_auto_allocate_network.py
+++ b/tempest/api/compute/admin/test_auto_allocate_network.py
@@ -16,7 +16,6 @@
from tempest.api.compute import base
from tempest.common import compute
-from tempest.common import credentials_factory as credentials
from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import test_utils
@@ -46,11 +45,6 @@
@classmethod
def skip_checks(cls):
super(AutoAllocateNetworkTest, cls).skip_checks()
- identity_version = cls.get_identity_version()
- if not credentials.is_admin_available(
- identity_version=identity_version):
- msg = "Missing Identity Admin API credentials in configuration."
- raise cls.skipException(msg)
if not CONF.service_available.neutron:
raise cls.skipException('Neutron is required')
if not utils.is_extension_enabled('auto-allocated-topology',
diff --git a/tempest/test.py b/tempest/test.py
index f390ae4..a4cc2cc 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -220,10 +220,13 @@
resource_setup or at test level.
"""
identity_version = cls.get_identity_version()
- if 'admin' in cls.credentials and not credentials.is_admin_available(
- identity_version=identity_version):
- msg = "Missing Identity Admin API credentials in configuration."
- raise cls.skipException(msg)
+ # setting force_tenant_isolation to True also needs admin credentials.
+ if ('admin' in cls.credentials or
+ getattr(cls, 'force_tenant_isolation', False)):
+ if not credentials.is_admin_available(
+ identity_version=identity_version):
+ raise cls.skipException(
+ "Missing Identity Admin API credentials in configuration.")
if 'alt' in cls.credentials and not credentials.is_alt_available(
identity_version=identity_version):
msg = "Missing a 2nd set of API credentials in configuration."