Merge "Honor suspend/pause config switches in scenario tests"

This commit is contained in:
Jenkins 2014-04-08 17:57:01 +00:00 committed by Gerrit Code Review
commit 08b38a5b18
3 changed files with 15 additions and 50 deletions

View File

@ -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"

View File

@ -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

View File

@ -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()