summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Belu <cbelu@cloudbasesolutions.com>2017-09-06 05:52:48 -0700
committerClaudiu Belu <cbelu@cloudbasesolutions.com>2017-09-06 16:22:24 +0000
commitfb70f974b2c92ab299ee8326617ebc40c7c13cbd (patch)
treecf2531631b8c011774613dd969e3977745008579
parentdbdca9de9f388c02e7b85b8fc03b0353ea0ff37b (diff)
Fixes flavor ref usage
The test_base's _get_flavor_ref method should be used when a flavor ref is required. Optional features rely on that method, as it adds the optional feature as a flavor extra_spec. The optional_feature's _get_flavor_ref should use the class' _FLAVOR_REF, not the CONF.compute.flavor_ref. Some tests might require a different flavor (secure_boot tests). Change-Id: Ie7f0b0f20fe76a7df5a9b60c8f4c290e810eb2df
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 08:35:00 +0000 Reviewed-on: https://review.openstack.org/501250 Project: openstack/oswin-tempest-plugin Branch: refs/heads/master
-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()