Browse Source

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
tags/0.1.0
Claudiu Belu 1 year ago
parent
commit
49f63c77d3

+ 27
- 17
oswin_tempest_plugin/tests/_mixins/resize.py View File

@@ -63,6 +63,22 @@ class _ResizeUtils(object):
63 63
         self._wait_for_server_status(server, 'VERIFY_RESIZE')
64 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
 
67 83
 class _ResizeMixin(_ResizeUtils):
68 84
     """Cold resize mixin.
@@ -84,23 +100,6 @@ class _ResizeMixin(_ResizeUtils):
84 100
 
85 101
     _SMALLER_FLAVOR = {}
86 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 104
     @testtools.skipUnless(CONF.compute_feature_enabled.resize,
106 105
                           'Resize is not available.')
@@ -109,6 +108,17 @@ class _ResizeMixin(_ResizeUtils):
109 108
                                              self._BIGGER_FLAVOR)
110 109
         self._check_resize(new_flavor['id'])
111 110
 
111
+
112
+class _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 122
     @testtools.skipUnless(CONF.compute_feature_enabled.resize,
113 123
                           'Resize is not available.')
114 124
     def test_resize_negative(self):

+ 0
- 1
oswin_tempest_plugin/tests/scenario/test_cluster.py View File

@@ -57,7 +57,6 @@ class HyperVClusterTest(test_base.TestBase,
57 57
     """
58 58
 
59 59
     _BIGGER_FLAVOR = {'disk': 1}
60
-    _BAD_FLAVOR = {'disk': -1}
61 60
 
62 61
     @classmethod
63 62
     def skip_checks(cls):

+ 2
- 1
oswin_tempest_plugin/tests/scenario/test_disks.py View File

@@ -24,7 +24,8 @@ CONF = config.CONF
24 24
 
25 25
 
26 26
 class _BaseDiskTestMixin(migrate._MigrateMixin,
27
-                         resize._ResizeMixin):
27
+                         resize._ResizeMixin,
28
+                         resize._ResizeNegativeMixin):
28 29
     """Image types / formats test suite.
29 30
 
30 31
     This test suite will spawn instances with a configured image and will

+ 2
- 1
oswin_tempest_plugin/tests/scenario/test_vnuma.py View File

@@ -28,7 +28,8 @@ class HyperVvNumaTestCase(test_base.TestBase,
28 28
                           migrate._MigrateMixin,
29 29
                           migrate._LiveMigrateMixin,
30 30
                           optional_feature._OptionalFeatureMixin,
31
-                          resize._ResizeMixin):
31
+                          resize._ResizeMixin,
32
+                          resize._ResizeNegativeMixin):
32 33
     """Hyper-V vNUMA test suite.
33 34
 
34 35
     This test suite will spawn instances requiring NUMA placement.

Loading…
Cancel
Save