From 9e5eac0bccb83cea756763d8c95f11bb479c09ec Mon Sep 17 00:00:00 2001 From: armando-migliaccio Date: Mon, 24 Mar 2014 10:55:31 -0700 Subject: [PATCH] Honor suspend/pause config switches in scenario tests Some tests missed checking for compute features as set in compute-feature-enabled section in tempest.conf. Reduce double-coverage of pause/suspend tests between basic and advanced server tests by removing pause and suspend actions in basic ops test. Closes-bug: 1296858 Change-Id: I80d785bb5b325ccfac3c5cfd9d076718cf587e80 --- .../test_network_advanced_server_ops.py | 11 +++-- tempest/scenario/test_server_advanced_ops.py | 14 +++---- tempest/scenario/test_server_basic_ops.py | 40 ------------------- 3 files changed, 15 insertions(+), 50 deletions(-) diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py index e7e97b52fe..0ba65cfea2 100644 --- a/tempest/scenario/test_network_advanced_server_ops.py +++ b/tempest/scenario/test_network_advanced_server_ops.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools + from tempest.common import debug from tempest.common.utils import data_utils from tempest import config @@ -158,6 +160,8 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): self.server.rebuild(image_ref_alt) self._wait_server_status_and_check_network_connectivity() + @testtools.skipUnless(CONF.compute_feature_enabled.pause, + 'Pause is not available.') @services('compute', 'network') def test_server_connectivity_pause_unpause(self): self.server.pause() @@ -167,6 +171,8 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): self.server.unpause() self._wait_server_status_and_check_network_connectivity() + @testtools.skipUnless(CONF.compute_feature_enabled.suspend, + 'Suspend is not available.') @services('compute', 'network') def test_server_connectivity_suspend_resume(self): self.server.suspend() @@ -176,11 +182,10 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): self.server.resume() self._wait_server_status_and_check_network_connectivity() + @testtools.skipUnless(CONF.compute_feature_enabled.resize, + 'Resize is not available.') @services('compute', 'network') def test_server_connectivity_resize(self): - if not CONF.compute_feature_enabled.resize: - msg = "Skipping test - resize not available on this host" - raise self.skipException(msg) resize_flavor = CONF.compute.flavor_ref_alt if resize_flavor == CONF.compute.flavor_ref: msg = "Skipping test - flavor_ref and flavor_ref_alt are identical" diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py index c0eb6e774b..5a1dc04aef 100644 --- a/tempest/scenario/test_server_advanced_ops.py +++ b/tempest/scenario/test_server_advanced_ops.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools + from tempest import config from tempest.openstack.common import log as logging from tempest.scenario import manager @@ -37,16 +39,12 @@ class TestServerAdvancedOps(manager.OfficialClientTest): cls.set_network_resources() super(TestServerAdvancedOps, cls).setUpClass() - if not CONF.compute_feature_enabled.resize: - msg = "Skipping test - resize not available on this host" - raise cls.skipException(msg) - - resize_flavor = CONF.compute.flavor_ref_alt - - if resize_flavor == CONF.compute.flavor_ref: + if CONF.compute.flavor_ref_alt == CONF.compute.flavor_ref: msg = "Skipping test - flavor_ref and flavor_ref_alt are identical" raise cls.skipException(msg) + @testtools.skipUnless(CONF.compute_feature_enabled.resize, + 'Resize is not available.') @test.services('compute') def test_resize_server_confirm(self): # We create an instance for use in this test @@ -65,6 +63,8 @@ class TestServerAdvancedOps(manager.OfficialClientTest): self.status_timeout( self.compute_client.servers, instance_id, 'ACTIVE') + @testtools.skipUnless(CONF.compute_feature_enabled.suspend, + 'Suspend is not available.') @test.services('compute') def test_server_sequence_suspend_resume(self): # We create an instance for use in this test diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py index d369f12576..285c030a17 100644 --- a/tempest/scenario/test_server_basic_ops.py +++ b/tempest/scenario/test_server_basic_ops.py @@ -99,42 +99,6 @@ class TestServerBasicOps(manager.OfficialClientTest): create_kwargs=create_kwargs) self.set_resource('instance', instance) - def pause_server(self): - instance = self.get_resource('instance') - instance_id = instance.id - LOG.debug("Pausing instance %s. Current status: %s", - instance_id, instance.status) - instance.pause() - self.status_timeout( - self.compute_client.servers, instance_id, 'PAUSED') - - def unpause_server(self): - instance = self.get_resource('instance') - instance_id = instance.id - LOG.debug("Unpausing instance %s. Current status: %s", - instance_id, instance.status) - instance.unpause() - self.status_timeout( - self.compute_client.servers, instance_id, 'ACTIVE') - - def suspend_server(self): - instance = self.get_resource('instance') - instance_id = instance.id - LOG.debug("Suspending instance %s. Current status: %s", - instance_id, instance.status) - instance.suspend() - self.status_timeout(self.compute_client.servers, - instance_id, 'SUSPENDED') - - def resume_server(self): - instance = self.get_resource('instance') - instance_id = instance.id - LOG.debug("Resuming instance %s. Current status: %s", - instance_id, instance.status) - instance.resume() - self.status_timeout( - self.compute_client.servers, instance_id, 'ACTIVE') - def terminate_instance(self): instance = self.get_resource('instance') instance.delete() @@ -163,9 +127,5 @@ class TestServerBasicOps(manager.OfficialClientTest): self.add_keypair() self.create_security_group() self.boot_instance() - self.pause_server() - self.unpause_server() - self.suspend_server() - self.resume_server() self.verify_ssh() self.terminate_instance()