Merge "Fixes flavor ref usage"

This commit is contained in:
Jenkins 2017-09-07 08:35:00 +00:00 committed by Gerrit Code Review
commit 727c9981cf
3 changed files with 13 additions and 14 deletions

View File

@ -38,7 +38,8 @@ class _OptionalFeatureMixin(resize._ResizeUtils):
turning on / off the optional feature), and check its network turning on / off the optional feature), and check its network
connectivity. 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, 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"'}. 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. 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): def _get_flavor_ref(self):
"""Gets a new optional feature flavor ref. """Gets a new optional feature flavor ref.
Creates a new flavor based on the configured flavor_ref, with some Creates a new flavor based on the test suite's configured _FLAVOR_REF,
updates specific to the optional feature. with some updates specific to the optional feature.
:returns: nova flavor ID. :returns: nova flavor ID.
""" """
@ -64,7 +65,7 @@ class _OptionalFeatureMixin(resize._ResizeUtils):
# _create_server will call this method to get the flavor reference # _create_server will call this method to get the flavor reference
# needed to spawn a new instance. Thus, any other test will spawn # needed to spawn a new instance. Thus, any other test will spawn
# instances with this Optional Feature. # 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) self._FEATURE_FLAVOR)
return new_flavor['id'] return new_flavor['id']
@ -75,18 +76,15 @@ class _OptionalFeatureMixin(resize._ResizeUtils):
@testtools.skipUnless(CONF.compute_feature_enabled.resize, @testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize is not available.') 'Resize is not available.')
def test_resize_add_feature(self): def test_resize_add_feature(self):
new_flavor = self._create_new_flavor(CONF.compute.flavor_ref, new_flavor = self._get_flavor_ref()
self._FEATURE_FLAVOR) server_tuple = self._create_server(self._FLAVOR_REF)
server_tuple = self._create_server(CONF.compute.flavor_ref) self._resize_server(server_tuple, new_flavor)
self._resize_server(server_tuple, new_flavor['id'])
self._check_server_connectivity(server_tuple) self._check_server_connectivity(server_tuple)
@testtools.skipUnless(CONF.compute_feature_enabled.resize, @testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize is not available.') 'Resize is not available.')
def test_resize_remove_feature(self): def test_resize_remove_feature(self):
new_flavor = self._create_new_flavor(CONF.compute.flavor_ref, vanilla_flavor = self._FLAVOR_REF
self._FEATURE_FLAVOR) server_tuple = self._create_server()
vanilla_flavor = CONF.compute.flavor_ref
server_tuple = self._create_server(new_flavor['id'])
self._resize_server(server_tuple, vanilla_flavor) self._resize_server(server_tuple, vanilla_flavor)
self._check_server_connectivity(server_tuple) self._check_server_connectivity(server_tuple)

View File

@ -70,7 +70,8 @@ class _ResizeMixin(_ResizeUtils):
This mixin will add cold resize tests. The tests will create a new 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. 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 updates. For example, if the vNUMA configuration is to be tested, the new
flavor would contain the flavor extra_spec 'hw:numa_nodes=1'. flavor would contain the flavor extra_spec 'hw:numa_nodes=1'.
""" """

View File

@ -161,7 +161,7 @@ class TestBase(tempest.test.BaseTestCase):
clients = self.os_primary clients = self.os_primary
name = data_utils.rand_name(self.__class__.__name__ + "-server") name = data_utils.rand_name(self.__class__.__name__ + "-server")
image_id = self._get_image_ref() 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() keypair = self.create_keypair()
tenant_network = self.get_tenant_network() tenant_network = self.get_tenant_network()
security_group = self._create_security_group() security_group = self._create_security_group()