diff --git a/oswin_tempest_plugin/tests/_mixins/resize.py b/oswin_tempest_plugin/tests/_mixins/resize.py index 60ab746..d8f16cb 100644 --- a/oswin_tempest_plugin/tests/_mixins/resize.py +++ b/oswin_tempest_plugin/tests/_mixins/resize.py @@ -63,6 +63,22 @@ class _ResizeUtils(object): self._wait_for_server_status(server, 'VERIFY_RESIZE') 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): """Cold resize mixin. @@ -84,23 +100,6 @@ class _ResizeMixin(_ResizeUtils): _SMALLER_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, 'Resize is not available.') @@ -109,6 +108,17 @@ class _ResizeMixin(_ResizeUtils): self._BIGGER_FLAVOR) 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, 'Resize is not available.') def test_resize_negative(self): diff --git a/oswin_tempest_plugin/tests/scenario/test_cluster.py b/oswin_tempest_plugin/tests/scenario/test_cluster.py index 8f094bd..92ae778 100644 --- a/oswin_tempest_plugin/tests/scenario/test_cluster.py +++ b/oswin_tempest_plugin/tests/scenario/test_cluster.py @@ -57,7 +57,6 @@ class HyperVClusterTest(test_base.TestBase, """ _BIGGER_FLAVOR = {'disk': 1} - _BAD_FLAVOR = {'disk': -1} @classmethod def skip_checks(cls): diff --git a/oswin_tempest_plugin/tests/scenario/test_disks.py b/oswin_tempest_plugin/tests/scenario/test_disks.py index 40bdf7a..9108b98 100644 --- a/oswin_tempest_plugin/tests/scenario/test_disks.py +++ b/oswin_tempest_plugin/tests/scenario/test_disks.py @@ -24,7 +24,8 @@ CONF = config.CONF class _BaseDiskTestMixin(migrate._MigrateMixin, - resize._ResizeMixin): + resize._ResizeMixin, + resize._ResizeNegativeMixin): """Image types / formats test suite. This test suite will spawn instances with a configured image and will diff --git a/oswin_tempest_plugin/tests/scenario/test_vnuma.py b/oswin_tempest_plugin/tests/scenario/test_vnuma.py index bb92f22..e665dca 100644 --- a/oswin_tempest_plugin/tests/scenario/test_vnuma.py +++ b/oswin_tempest_plugin/tests/scenario/test_vnuma.py @@ -28,7 +28,8 @@ class HyperVvNumaTestCase(test_base.TestBase, migrate._MigrateMixin, migrate._LiveMigrateMixin, optional_feature._OptionalFeatureMixin, - resize._ResizeMixin): + resize._ResizeMixin, + resize._ResizeNegativeMixin): """Hyper-V vNUMA test suite. This test suite will spawn instances requiring NUMA placement.