Prevent failures when running as non-admin
In some cases a skip method was needed to check for non-admin. In other cases
there was already a try/except to handle on-admin but it needed to be changed
to use is_admin_available. NegativeAutoTest was changed to push creation of
an admin client to the point where the need has been established.
Also fixed some skip_checks methods to call super first.
Change-Id: Ie58135285a4c95c2eed9c0462c4e76af3ad5d97e
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 4995209..9f1a548 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -352,10 +352,10 @@
@classmethod
def skip_checks(cls):
+ super(BaseComputeAdminTest, cls).skip_checks()
if not credentials.is_admin_available():
msg = ("Missing Identity Admin API credentials in configuration.")
raise cls.skipException(msg)
- super(BaseComputeAdminTest, cls).skip_checks()
@classmethod
def setup_credentials(cls):
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 1f76b1c..28676b0 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -18,6 +18,7 @@
from tempest_lib import exceptions as lib_exc
from tempest import clients
+from tempest.common import credentials
from tempest.common import fixed_network
from tempest import config
from tempest import exceptions
@@ -175,14 +176,17 @@
"""Base test case class for all Volume Admin API tests."""
@classmethod
+ def skip_checks(cls):
+ super(BaseVolumeAdminTest, cls).skip_checks()
+ if not credentials.is_admin_available():
+ msg = ("Missing Identity Admin API credentials in configuration.")
+ raise cls.skipException(msg)
+
+ @classmethod
def setup_credentials(cls):
super(BaseVolumeAdminTest, cls).setup_credentials()
- try:
- cls.adm_creds = cls.isolated_creds.get_admin_creds()
- cls.os_adm = clients.Manager(credentials=cls.adm_creds)
- except NotImplementedError:
- msg = "Missing Volume Admin API credentials in configuration."
- raise cls.skipException(msg)
+ cls.adm_creds = cls.isolated_creds.get_admin_creds()
+ cls.os_adm = clients.Manager(credentials=cls.adm_creds)
@classmethod
def setup_clients(cls):
diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py
index 92e6c74..c5e8012 100644
--- a/tempest/scenario/test_aggregates_basic_ops.py
+++ b/tempest/scenario/test_aggregates_basic_ops.py
@@ -16,6 +16,7 @@
from oslo_log import log as logging
from tempest_lib.common.utils import data_utils
+from tempest.common import credentials
from tempest.common import tempest_fixtures as fixtures
from tempest.scenario import manager
from tempest import test
@@ -34,6 +35,13 @@
Deletes aggregate
"""
@classmethod
+ def skip_checks(cls):
+ super(TestAggregatesBasicOps, cls).skip_checks()
+ if not credentials.is_admin_available():
+ msg = ("Missing Identity Admin API credentials in configuration.")
+ raise cls.skipException(msg)
+
+ @classmethod
def setup_clients(cls):
super(TestAggregatesBasicOps, cls).setup_clients()
cls.aggregates_client = cls.manager.aggregates_client
diff --git a/tempest/test.py b/tempest/test.py
index da936b4..4451610 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -467,8 +467,6 @@
super(NegativeAutoTest, cls).setUpClass()
os = cls.get_client_manager()
cls.client = os.negative_client
- os_admin = clients.AdminManager(service=cls._service)
- cls.admin_client = os_admin.negative_client
@staticmethod
def load_tests(*args):
@@ -596,7 +594,13 @@
"mechanism")
if "admin_client" in description and description["admin_client"]:
- client = self.admin_client
+ if not credentials.is_admin_available():
+ msg = ("Missing Identity Admin API credentials in"
+ "configuration.")
+ raise self.skipException(msg)
+ creds = self.isolated_creds.get_admin_creds()
+ os_adm = clients.Manager(credentials=creds)
+ client = os_adm.negative_client
else:
client = self.client
resp, resp_body = client.send_request(method, new_url,