summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Belu <cbelu@cloudbasesolutions.com>2017-09-06 09:11:12 -0700
committerClaudiu Belu <cbelu@cloudbasesolutions.com>2017-09-07 01:36:07 -0700
commit49f63c77d3ebf5c18f874f63ab10cb159969dce6 (patch)
tree5168124d156a41fa52493ff75fa6cc9b2bf9fbb3
parent727c9981cfc8ba59731addf74928363d6cc044de (diff)
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
Notes
Notes (review): Code-Review+2: Claudiu Belu <cbelu@cloudbasesolutions.com> Workflow+1: Claudiu Belu <cbelu@cloudbasesolutions.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 07 Sep 2017 12:09:35 +0000 Reviewed-on: https://review.openstack.org/501631 Project: openstack/oswin-tempest-plugin Branch: refs/heads/master
-rw-r--r--oswin_tempest_plugin/tests/_mixins/resize.py44
-rw-r--r--oswin_tempest_plugin/tests/scenario/test_cluster.py1
-rw-r--r--oswin_tempest_plugin/tests/scenario/test_disks.py3
-rw-r--r--oswin_tempest_plugin/tests/scenario/test_vnuma.py3
4 files changed, 31 insertions, 20 deletions
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):
63 self._wait_for_server_status(server, 'VERIFY_RESIZE') 63 self._wait_for_server_status(server, 'VERIFY_RESIZE')
64 self.servers_client.confirm_resize_server(server['id']) 64 self.servers_client.confirm_resize_server(server['id'])
65 65
66 def _check_resize(self, resize_flavor_id, original_flavor_id=None,
67 expected_fail=False):
68 original_flavor_id = original_flavor_id or self._get_flavor_ref()
69 server_tuple = self._create_server(original_flavor_id)
70
71 if expected_fail:
72 self.assertRaises(exceptions.ResizeException,
73 self._resize_server,
74 server_tuple, resize_flavor_id)
75 else:
76 self._resize_server(server_tuple, resize_flavor_id)
77
78 # assert that the server is still reachable, even if the resize
79 # failed.
80 self._check_server_connectivity(server_tuple)
81
66 82
67class _ResizeMixin(_ResizeUtils): 83class _ResizeMixin(_ResizeUtils):
68 """Cold resize mixin. 84 """Cold resize mixin.
@@ -84,23 +100,6 @@ class _ResizeMixin(_ResizeUtils):
84 100
85 _SMALLER_FLAVOR = {} 101 _SMALLER_FLAVOR = {}
86 _BIGGER_FLAVOR = {} 102 _BIGGER_FLAVOR = {}
87 _BAD_FLAVOR = {}
88
89 def _check_resize(self, resize_flavor_id, original_flavor_id=None,
90 expected_fail=False):
91 original_flavor_id = original_flavor_id or self._get_flavor_ref()
92 server_tuple = self._create_server(original_flavor_id)
93
94 if expected_fail:
95 self.assertRaises(exceptions.ResizeException,
96 self._resize_server,
97 server_tuple, resize_flavor_id)
98 else:
99 self._resize_server(server_tuple, resize_flavor_id)
100
101 # assert that the server is still reachable, even if the resize
102 # failed.
103 self._check_server_connectivity(server_tuple)
104 103
105 @testtools.skipUnless(CONF.compute_feature_enabled.resize, 104 @testtools.skipUnless(CONF.compute_feature_enabled.resize,
106 'Resize is not available.') 105 'Resize is not available.')
@@ -109,6 +108,17 @@ class _ResizeMixin(_ResizeUtils):
109 self._BIGGER_FLAVOR) 108 self._BIGGER_FLAVOR)
110 self._check_resize(new_flavor['id']) 109 self._check_resize(new_flavor['id'])
111 110
111
112class _ResizeNegativeMixin(_ResizeUtils):
113 """Cold resize negative mixin.
114
115 This mixin will add cold resize negative tests. The tests will create a
116 new instance, resize it to an invalid flavor, check that the resize
117 failed, and check the instance's connectivity.
118 """
119
120 _BAD_FLAVOR = {}
121
112 @testtools.skipUnless(CONF.compute_feature_enabled.resize, 122 @testtools.skipUnless(CONF.compute_feature_enabled.resize,
113 'Resize is not available.') 123 'Resize is not available.')
114 def test_resize_negative(self): 124 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,
57 """ 57 """
58 58
59 _BIGGER_FLAVOR = {'disk': 1} 59 _BIGGER_FLAVOR = {'disk': 1}
60 _BAD_FLAVOR = {'disk': -1}
61 60
62 @classmethod 61 @classmethod
63 def skip_checks(cls): 62 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
24 24
25 25
26class _BaseDiskTestMixin(migrate._MigrateMixin, 26class _BaseDiskTestMixin(migrate._MigrateMixin,
27 resize._ResizeMixin): 27 resize._ResizeMixin,
28 resize._ResizeNegativeMixin):
28 """Image types / formats test suite. 29 """Image types / formats test suite.
29 30
30 This test suite will spawn instances with a configured image and will 31 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,
28 migrate._MigrateMixin, 28 migrate._MigrateMixin,
29 migrate._LiveMigrateMixin, 29 migrate._LiveMigrateMixin,
30 optional_feature._OptionalFeatureMixin, 30 optional_feature._OptionalFeatureMixin,
31 resize._ResizeMixin): 31 resize._ResizeMixin,
32 resize._ResizeNegativeMixin):
32 """Hyper-V vNUMA test suite. 33 """Hyper-V vNUMA test suite.
33 34
34 This test suite will spawn instances requiring NUMA placement. 35 This test suite will spawn instances requiring NUMA placement.