summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-09-07 08:35:00 +0000
committerGerrit Code Review <review@openstack.org>2017-09-07 08:35:00 +0000
commit727c9981cfc8ba59731addf74928363d6cc044de (patch)
tree5a360fecd8c6dde4c5cd4d306ada65665bd46d32
parentefcec59cfac715cf11bcc89c59dcb9aa77256b2f (diff)
parentfb70f974b2c92ab299ee8326617ebc40c7c13cbd (diff)
Merge "Fixes flavor ref usage"
-rw-r--r--oswin_tempest_plugin/tests/_mixins/optional_feature.py22
-rw-r--r--oswin_tempest_plugin/tests/_mixins/resize.py3
-rw-r--r--oswin_tempest_plugin/tests/test_base.py2
3 files changed, 13 insertions, 14 deletions
diff --git a/oswin_tempest_plugin/tests/_mixins/optional_feature.py b/oswin_tempest_plugin/tests/_mixins/optional_feature.py
index 0ad83b4..9a5189b 100644
--- a/oswin_tempest_plugin/tests/_mixins/optional_feature.py
+++ b/oswin_tempest_plugin/tests/_mixins/optional_feature.py
@@ -38,7 +38,8 @@ class _OptionalFeatureMixin(resize._ResizeUtils):
38 turning on / off the optional feature), and check its network 38 turning on / off the optional feature), and check its network
39 connectivity. 39 connectivity.
40 40
41 The optional feature flavor is based on the configured compute.flavor_ref, 41 The optional feature flavor is based on the test suite's configured
42 _FLAVOR_REF (typically compute.flavor_ref or compute.flavor_ref_alt),
42 with some updates. For example, if the vNUMA configuration is to be tested, 43 with some updates. For example, if the vNUMA configuration is to be tested,
43 the new flavor would contain the flavor extra_spec {'hw:numa_nodes="1"'}. 44 the new flavor would contain the flavor extra_spec {'hw:numa_nodes="1"'}.
44 Keep in mind that all the extra_spec keys and values have to be strings. 45 Keep in mind that all the extra_spec keys and values have to be strings.
@@ -55,8 +56,8 @@ class _OptionalFeatureMixin(resize._ResizeUtils):
55 def _get_flavor_ref(self): 56 def _get_flavor_ref(self):
56 """Gets a new optional feature flavor ref. 57 """Gets a new optional feature flavor ref.
57 58
58 Creates a new flavor based on the configured flavor_ref, with some 59 Creates a new flavor based on the test suite's configured _FLAVOR_REF,
59 updates specific to the optional feature. 60 with some updates specific to the optional feature.
60 61
61 :returns: nova flavor ID. 62 :returns: nova flavor ID.
62 """ 63 """
@@ -64,7 +65,7 @@ class _OptionalFeatureMixin(resize._ResizeUtils):
64 # _create_server will call this method to get the flavor reference 65 # _create_server will call this method to get the flavor reference
65 # needed to spawn a new instance. Thus, any other test will spawn 66 # needed to spawn a new instance. Thus, any other test will spawn
66 # instances with this Optional Feature. 67 # instances with this Optional Feature.
67 new_flavor = self._create_new_flavor(CONF.compute.flavor_ref, 68 new_flavor = self._create_new_flavor(self._FLAVOR_REF,
68 self._FEATURE_FLAVOR) 69 self._FEATURE_FLAVOR)
69 return new_flavor['id'] 70 return new_flavor['id']
70 71
@@ -75,18 +76,15 @@ class _OptionalFeatureMixin(resize._ResizeUtils):
75 @testtools.skipUnless(CONF.compute_feature_enabled.resize, 76 @testtools.skipUnless(CONF.compute_feature_enabled.resize,
76 'Resize is not available.') 77 'Resize is not available.')
77 def test_resize_add_feature(self): 78 def test_resize_add_feature(self):
78 new_flavor = self._create_new_flavor(CONF.compute.flavor_ref, 79 new_flavor = self._get_flavor_ref()
79 self._FEATURE_FLAVOR) 80 server_tuple = self._create_server(self._FLAVOR_REF)
80 server_tuple = self._create_server(CONF.compute.flavor_ref) 81 self._resize_server(server_tuple, new_flavor)
81 self._resize_server(server_tuple, new_flavor['id'])
82 self._check_server_connectivity(server_tuple) 82 self._check_server_connectivity(server_tuple)
83 83
84 @testtools.skipUnless(CONF.compute_feature_enabled.resize, 84 @testtools.skipUnless(CONF.compute_feature_enabled.resize,
85 'Resize is not available.') 85 'Resize is not available.')
86 def test_resize_remove_feature(self): 86 def test_resize_remove_feature(self):
87 new_flavor = self._create_new_flavor(CONF.compute.flavor_ref, 87 vanilla_flavor = self._FLAVOR_REF
88 self._FEATURE_FLAVOR) 88 server_tuple = self._create_server()
89 vanilla_flavor = CONF.compute.flavor_ref
90 server_tuple = self._create_server(new_flavor['id'])
91 self._resize_server(server_tuple, vanilla_flavor) 89 self._resize_server(server_tuple, vanilla_flavor)
92 self._check_server_connectivity(server_tuple) 90 self._check_server_connectivity(server_tuple)
diff --git a/oswin_tempest_plugin/tests/_mixins/resize.py b/oswin_tempest_plugin/tests/_mixins/resize.py
index 91fa86b..60ab746 100644
--- a/oswin_tempest_plugin/tests/_mixins/resize.py
+++ b/oswin_tempest_plugin/tests/_mixins/resize.py
@@ -70,7 +70,8 @@ class _ResizeMixin(_ResizeUtils):
70 This mixin will add cold resize tests. The tests will create a new 70 This mixin will add cold resize tests. The tests will create a new
71 instance, resize it to a new flavor, and check its network connectivity. 71 instance, resize it to a new flavor, and check its network connectivity.
72 72
73 The new flavor is based on the configured compute.flavor_ref, with some 73 The new flavor is based on the test suite's configured _FLAVOR_REF (
74 typically compute.flavor_ref or compute.flavor_ref_alt), with some
74 updates. For example, if the vNUMA configuration is to be tested, the new 75 updates. For example, if the vNUMA configuration is to be tested, the new
75 flavor would contain the flavor extra_spec 'hw:numa_nodes=1'. 76 flavor would contain the flavor extra_spec 'hw:numa_nodes=1'.
76 """ 77 """
diff --git a/oswin_tempest_plugin/tests/test_base.py b/oswin_tempest_plugin/tests/test_base.py
index bda6c93..7999742 100644
--- a/oswin_tempest_plugin/tests/test_base.py
+++ b/oswin_tempest_plugin/tests/test_base.py
@@ -161,7 +161,7 @@ class TestBase(tempest.test.BaseTestCase):
161 clients = self.os_primary 161 clients = self.os_primary
162 name = data_utils.rand_name(self.__class__.__name__ + "-server") 162 name = data_utils.rand_name(self.__class__.__name__ + "-server")
163 image_id = self._get_image_ref() 163 image_id = self._get_image_ref()
164 flavor = flavor or self._FLAVOR_REF or self._get_flavor_ref() 164 flavor = flavor or self._get_flavor_ref()
165 keypair = self.create_keypair() 165 keypair = self.create_keypair()
166 tenant_network = self.get_tenant_network() 166 tenant_network = self.get_tenant_network()
167 security_group = self._create_security_group() 167 security_group = self._create_security_group()