splits the resize mixin into two
Splits the _ResizeMixin into _ResizeMixin and _ResizeNegativeMixin. Not all test scenarios have negative test scenarios (the cluster tests). Change-Id: Icab2ebe1233f1bcf4f469d141a8046a5bbbed38e
This commit is contained in:
parent
727c9981cf
commit
49f63c77d3
|
@ -63,6 +63,22 @@ class _ResizeUtils(object):
|
||||||
self._wait_for_server_status(server, 'VERIFY_RESIZE')
|
self._wait_for_server_status(server, 'VERIFY_RESIZE')
|
||||||
self.servers_client.confirm_resize_server(server['id'])
|
self.servers_client.confirm_resize_server(server['id'])
|
||||||
|
|
||||||
|
def _check_resize(self, resize_flavor_id, original_flavor_id=None,
|
||||||
|
expected_fail=False):
|
||||||
|
original_flavor_id = original_flavor_id or self._get_flavor_ref()
|
||||||
|
server_tuple = self._create_server(original_flavor_id)
|
||||||
|
|
||||||
|
if expected_fail:
|
||||||
|
self.assertRaises(exceptions.ResizeException,
|
||||||
|
self._resize_server,
|
||||||
|
server_tuple, resize_flavor_id)
|
||||||
|
else:
|
||||||
|
self._resize_server(server_tuple, resize_flavor_id)
|
||||||
|
|
||||||
|
# assert that the server is still reachable, even if the resize
|
||||||
|
# failed.
|
||||||
|
self._check_server_connectivity(server_tuple)
|
||||||
|
|
||||||
|
|
||||||
class _ResizeMixin(_ResizeUtils):
|
class _ResizeMixin(_ResizeUtils):
|
||||||
"""Cold resize mixin.
|
"""Cold resize mixin.
|
||||||
|
@ -84,23 +100,6 @@ class _ResizeMixin(_ResizeUtils):
|
||||||
|
|
||||||
_SMALLER_FLAVOR = {}
|
_SMALLER_FLAVOR = {}
|
||||||
_BIGGER_FLAVOR = {}
|
_BIGGER_FLAVOR = {}
|
||||||
_BAD_FLAVOR = {}
|
|
||||||
|
|
||||||
def _check_resize(self, resize_flavor_id, original_flavor_id=None,
|
|
||||||
expected_fail=False):
|
|
||||||
original_flavor_id = original_flavor_id or self._get_flavor_ref()
|
|
||||||
server_tuple = self._create_server(original_flavor_id)
|
|
||||||
|
|
||||||
if expected_fail:
|
|
||||||
self.assertRaises(exceptions.ResizeException,
|
|
||||||
self._resize_server,
|
|
||||||
server_tuple, resize_flavor_id)
|
|
||||||
else:
|
|
||||||
self._resize_server(server_tuple, resize_flavor_id)
|
|
||||||
|
|
||||||
# assert that the server is still reachable, even if the resize
|
|
||||||
# failed.
|
|
||||||
self._check_server_connectivity(server_tuple)
|
|
||||||
|
|
||||||
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
|
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
|
||||||
'Resize is not available.')
|
'Resize is not available.')
|
||||||
|
@ -109,6 +108,17 @@ class _ResizeMixin(_ResizeUtils):
|
||||||
self._BIGGER_FLAVOR)
|
self._BIGGER_FLAVOR)
|
||||||
self._check_resize(new_flavor['id'])
|
self._check_resize(new_flavor['id'])
|
||||||
|
|
||||||
|
|
||||||
|
class _ResizeNegativeMixin(_ResizeUtils):
|
||||||
|
"""Cold resize negative mixin.
|
||||||
|
|
||||||
|
This mixin will add cold resize negative tests. The tests will create a
|
||||||
|
new instance, resize it to an invalid flavor, check that the resize
|
||||||
|
failed, and check the instance's connectivity.
|
||||||
|
"""
|
||||||
|
|
||||||
|
_BAD_FLAVOR = {}
|
||||||
|
|
||||||
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
|
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
|
||||||
'Resize is not available.')
|
'Resize is not available.')
|
||||||
def test_resize_negative(self):
|
def test_resize_negative(self):
|
||||||
|
|
|
@ -57,7 +57,6 @@ class HyperVClusterTest(test_base.TestBase,
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_BIGGER_FLAVOR = {'disk': 1}
|
_BIGGER_FLAVOR = {'disk': 1}
|
||||||
_BAD_FLAVOR = {'disk': -1}
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
|
|
|
@ -24,7 +24,8 @@ CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class _BaseDiskTestMixin(migrate._MigrateMixin,
|
class _BaseDiskTestMixin(migrate._MigrateMixin,
|
||||||
resize._ResizeMixin):
|
resize._ResizeMixin,
|
||||||
|
resize._ResizeNegativeMixin):
|
||||||
"""Image types / formats test suite.
|
"""Image types / formats test suite.
|
||||||
|
|
||||||
This test suite will spawn instances with a configured image and will
|
This test suite will spawn instances with a configured image and will
|
||||||
|
|
|
@ -28,7 +28,8 @@ class HyperVvNumaTestCase(test_base.TestBase,
|
||||||
migrate._MigrateMixin,
|
migrate._MigrateMixin,
|
||||||
migrate._LiveMigrateMixin,
|
migrate._LiveMigrateMixin,
|
||||||
optional_feature._OptionalFeatureMixin,
|
optional_feature._OptionalFeatureMixin,
|
||||||
resize._ResizeMixin):
|
resize._ResizeMixin,
|
||||||
|
resize._ResizeNegativeMixin):
|
||||||
"""Hyper-V vNUMA test suite.
|
"""Hyper-V vNUMA test suite.
|
||||||
|
|
||||||
This test suite will spawn instances requiring NUMA placement.
|
This test suite will spawn instances requiring NUMA placement.
|
||||||
|
|
Loading…
Reference in New Issue