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): turning on / off the optional feature), and check its network connectivity. - The optional feature flavor is based on the configured compute.flavor_ref, + The optional feature flavor is based on the test suite's configured + _FLAVOR_REF (typically compute.flavor_ref or compute.flavor_ref_alt), with some updates. For example, if the vNUMA configuration is to be tested, the new flavor would contain the flavor extra_spec {'hw:numa_nodes="1"'}. Keep in mind that all the extra_spec keys and values have to be strings. @@ -55,8 +56,8 @@ class _OptionalFeatureMixin(resize._ResizeUtils): def _get_flavor_ref(self): """Gets a new optional feature flavor ref. - Creates a new flavor based on the configured flavor_ref, with some - updates specific to the optional feature. + Creates a new flavor based on the test suite's configured _FLAVOR_REF, + with some updates specific to the optional feature. :returns: nova flavor ID. """ @@ -64,7 +65,7 @@ class _OptionalFeatureMixin(resize._ResizeUtils): # _create_server will call this method to get the flavor reference # needed to spawn a new instance. Thus, any other test will spawn # instances with this Optional Feature. - new_flavor = self._create_new_flavor(CONF.compute.flavor_ref, + new_flavor = self._create_new_flavor(self._FLAVOR_REF, self._FEATURE_FLAVOR) return new_flavor['id'] @@ -75,18 +76,15 @@ class _OptionalFeatureMixin(resize._ResizeUtils): @testtools.skipUnless(CONF.compute_feature_enabled.resize, 'Resize is not available.') def test_resize_add_feature(self): - new_flavor = self._create_new_flavor(CONF.compute.flavor_ref, - self._FEATURE_FLAVOR) - server_tuple = self._create_server(CONF.compute.flavor_ref) - self._resize_server(server_tuple, new_flavor['id']) + new_flavor = self._get_flavor_ref() + server_tuple = self._create_server(self._FLAVOR_REF) + self._resize_server(server_tuple, new_flavor) self._check_server_connectivity(server_tuple) @testtools.skipUnless(CONF.compute_feature_enabled.resize, 'Resize is not available.') def test_resize_remove_feature(self): - new_flavor = self._create_new_flavor(CONF.compute.flavor_ref, - self._FEATURE_FLAVOR) - vanilla_flavor = CONF.compute.flavor_ref - server_tuple = self._create_server(new_flavor['id']) + vanilla_flavor = self._FLAVOR_REF + server_tuple = self._create_server() self._resize_server(server_tuple, vanilla_flavor) 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): This mixin will add cold resize tests. The tests will create a new instance, resize it to a new flavor, and check its network connectivity. - The new flavor is based on the configured compute.flavor_ref, with some + The new flavor is based on the test suite's configured _FLAVOR_REF ( + typically compute.flavor_ref or compute.flavor_ref_alt), with some updates. For example, if the vNUMA configuration is to be tested, the new flavor would contain the flavor extra_spec 'hw:numa_nodes=1'. """ 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): clients = self.os_primary name = data_utils.rand_name(self.__class__.__name__ + "-server") image_id = self._get_image_ref() - flavor = flavor or self._FLAVOR_REF or self._get_flavor_ref() + flavor = flavor or self._get_flavor_ref() keypair = self.create_keypair() tenant_network = self.get_tenant_network() security_group = self._create_security_group()