Check if service is available for cli tests
This commit adds checks to the CLI tests to see whether the service
that is being tested is available or not. Previously the tests would
run regardless of whether the service was listed as available in the
config file or not.
Change-Id: I16e0bbab85d2234d671ea2577757b38480e66d69
diff --git a/tempest/cli/simple_read_only/test_cinder.py b/tempest/cli/simple_read_only/test_cinder.py
index 25157a4..a8eb84c 100644
--- a/tempest/cli/simple_read_only/test_cinder.py
+++ b/tempest/cli/simple_read_only/test_cinder.py
@@ -20,7 +20,10 @@
import subprocess
import tempest.cli
+from tempest import config
+
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -32,6 +35,13 @@
their own. They only verify the structure of output if present.
"""
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.cinder:
+ msg = ("%s skipped as Cinder is not available" % cls.__name__)
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyCinderClientTest, cls).setUpClass()
+
def test_cinder_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.cinder,
diff --git a/tempest/cli/simple_read_only/test_glance.py b/tempest/cli/simple_read_only/test_glance.py
index a5a229c..ada6b51 100644
--- a/tempest/cli/simple_read_only/test_glance.py
+++ b/tempest/cli/simple_read_only/test_glance.py
@@ -37,6 +37,13 @@
their own. They only verify the structure of output if present.
"""
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.glance:
+ msg = ("%s skipped as Glance is not available" % cls.__name__)
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyGlanceClientTest, cls).setUpClass()
+
def test_glance_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.glance,
diff --git a/tempest/cli/simple_read_only/test_nova.py b/tempest/cli/simple_read_only/test_nova.py
index 1aa8f2c..d986975 100644
--- a/tempest/cli/simple_read_only/test_nova.py
+++ b/tempest/cli/simple_read_only/test_nova.py
@@ -44,6 +44,13 @@
"""
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.nova:
+ msg = ("%s skipped as Nova is not available" % cls.__name__)
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyNovaClientTest, cls).setUpClass()
+
def test_admin_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.nova,
diff --git a/tempest/cli/simple_read_only/test_nova_manage.py b/tempest/cli/simple_read_only/test_nova_manage.py
index 524db5d..d1995bb 100644
--- a/tempest/cli/simple_read_only/test_nova_manage.py
+++ b/tempest/cli/simple_read_only/test_nova_manage.py
@@ -18,9 +18,11 @@
import subprocess
import tempest.cli
+from tempest import config
from tempest.openstack.common import log as logging
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -36,6 +38,13 @@
"""
+ @classmethod
+ def setUpClass(cls):
+ if not CONF.service_available.nova:
+ msg = ("%s skipped as Nova is not available" % cls.__name__)
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyNovaManageTest, cls).setUpClass()
+
def test_admin_fake_action(self):
self.assertRaises(subprocess.CalledProcessError,
self.nova_manage,