Support disabling suspend/resume for compute api
The suspend extension may not be available,
allow it to be disabled.
Change-Id: I6ec48d2903f817334ec94b0baa8ba223d2602d1f
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index eb8d458..28a2d34 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -350,6 +350,10 @@
# Does the test environment support pausing? (boolean value)
#pause=true
+# Does the test environment support suspend/resume? (boolean
+# value)
+#suspend=true
+
# Does the test environment support live migration available?
# (boolean value)
#live_migration=false
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 8afd5f9..cd131a2 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -31,6 +31,7 @@
class ServerActionsTestJSON(base.BaseV2ComputeTest):
resize_available = CONF.compute_feature_enabled.resize
pause_available = CONF.compute_feature_enabled.pause
+ suspend_available = CONF.compute_feature_enabled.suspend
run_ssh = CONF.compute.run_ssh
def setUp(self):
@@ -361,6 +362,7 @@
self.assertEqual(202, resp.status)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ @testtools.skipIf(not suspend_available, 'Suspend is not available.')
@test.attr(type='gate')
def test_suspend_resume_server(self):
resp, server = self.client.suspend_server(self.server_id)
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index b05fc12..cbfec5c 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -30,6 +30,7 @@
class ServersNegativeTestJSON(base.BaseV2ComputeTest):
pause_available = CONF.compute_feature_enabled.pause
+ suspend_available = CONF.compute_feature_enabled.suspend
def setUp(self):
super(ServersNegativeTestJSON, self).setUp()
@@ -332,6 +333,7 @@
self.client.unpause_server,
self.server_id)
+ @testtools.skipIf(not suspend_available, 'Suspend is not available.')
@test.attr(type=['negative', 'gate'])
def test_suspend_non_existent_server(self):
# suspend a non existent server
@@ -339,6 +341,7 @@
self.assertRaises(exceptions.NotFound, self.client.suspend_server,
nonexistent_server)
+ @testtools.skipIf(not suspend_available, 'Suspend is not available.')
@test.attr(type=['negative', 'gate'])
def test_suspend_server_invalid_state(self):
# suspend a suspended server.
@@ -351,6 +354,7 @@
self.client.suspend_server,
self.server_id)
+ @testtools.skipIf(not suspend_available, 'Suspend is not available.')
@test.attr(type=['negative', 'gate'])
def test_resume_non_existent_server(self):
# resume a non existent server
@@ -358,6 +362,7 @@
self.assertRaises(exceptions.NotFound, self.client.resume_server,
nonexistent_server)
+ @testtools.skipIf(not suspend_available, 'Suspend is not available.')
@test.attr(type=['negative', 'gate'])
def test_resume_server_invalid_state(self):
# resume an active server.
diff --git a/tempest/config.py b/tempest/config.py
index 9f279fb..ef2ac16 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -255,6 +255,9 @@
cfg.BoolOpt('pause',
default=True,
help="Does the test environment support pausing?"),
+ cfg.BoolOpt('suspend',
+ default=True,
+ help="Does the test environment support suspend/resume?"),
cfg.BoolOpt('live_migration',
default=False,
help="Does the test environment support live migration "