Create default network for several compute tests
Chipping away at the referenced bug, this commit introduces a class-level variable on BaseV2ComputeTest that triggers setup_credentials to create a default network, and sets it for several classes where the problem has been observed. The class variable is so we can whack-a-mole with one line instead of four whenever this problem pops up. Change-Id: Ia34fe3b41261de02918713c2a948e6c56554bf6f Partial-Bug: #1844568
This commit is contained in:
parent
97052fae12
commit
bfaa50f18b
|
@ -31,6 +31,13 @@ LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
class LiveMigrationTestBase(base.BaseV2ComputeAdminTest):
|
class LiveMigrationTestBase(base.BaseV2ComputeAdminTest):
|
||||||
|
|
||||||
|
# These tests don't attempt any SSH validation nor do they use
|
||||||
|
# floating IPs on the instance, so all we need is a network and
|
||||||
|
# a subnet so the instance being migrated has a single port, but
|
||||||
|
# we need that to make sure we are properly updating the port
|
||||||
|
# host bindings during the live migration.
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
super(LiveMigrationTestBase, cls).skip_checks()
|
super(LiveMigrationTestBase, cls).skip_checks()
|
||||||
|
@ -43,16 +50,6 @@ class LiveMigrationTestBase(base.BaseV2ComputeAdminTest):
|
||||||
raise cls.skipException(
|
raise cls.skipException(
|
||||||
"Less than 2 compute nodes, skipping migration test.")
|
"Less than 2 compute nodes, skipping migration test.")
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
# These tests don't attempt any SSH validation nor do they use
|
|
||||||
# floating IPs on the instance, so all we need is a network and
|
|
||||||
# a subnet so the instance being migrated has a single port, but
|
|
||||||
# we need that to make sure we are properly updating the port
|
|
||||||
# host bindings during the live migration.
|
|
||||||
cls.set_network_resources(network=True, subnet=True)
|
|
||||||
super(LiveMigrationTestBase, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(LiveMigrationTestBase, cls).setup_clients()
|
super(LiveMigrationTestBase, cls).setup_clients()
|
||||||
|
|
|
@ -39,6 +39,9 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||||
"""Base test case class for all Compute API tests."""
|
"""Base test case class for all Compute API tests."""
|
||||||
|
|
||||||
force_tenant_isolation = False
|
force_tenant_isolation = False
|
||||||
|
# Set this to True in subclasses to create a default network. See
|
||||||
|
# https://bugs.launchpad.net/tempest/+bug/1844568
|
||||||
|
create_default_network = False
|
||||||
|
|
||||||
# TODO(andreaf) We should care also for the alt_manager here
|
# TODO(andreaf) We should care also for the alt_manager here
|
||||||
# but only once client lazy load in the manager is done
|
# but only once client lazy load in the manager is done
|
||||||
|
@ -58,7 +61,10 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_credentials(cls):
|
def setup_credentials(cls):
|
||||||
cls.set_network_resources()
|
# Setting network=True, subnet=True creates a default network
|
||||||
|
cls.set_network_resources(
|
||||||
|
network=cls.create_default_network,
|
||||||
|
subnet=cls.create_default_network)
|
||||||
super(BaseV2ComputeTest, cls).setup_credentials()
|
super(BaseV2ComputeTest, cls).setup_credentials()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -24,18 +24,14 @@ CONF = config.CONF
|
||||||
class BaseSecurityGroupsTest(base.BaseV2ComputeTest):
|
class BaseSecurityGroupsTest(base.BaseV2ComputeTest):
|
||||||
max_microversion = '2.35'
|
max_microversion = '2.35'
|
||||||
|
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
super(BaseSecurityGroupsTest, cls).skip_checks()
|
super(BaseSecurityGroupsTest, cls).skip_checks()
|
||||||
if not utils.get_service_list()['network']:
|
if not utils.get_service_list()['network']:
|
||||||
raise cls.skipException("network service not enabled.")
|
raise cls.skipException("network service not enabled.")
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
# A network and a subnet will be created for these tests
|
|
||||||
cls.set_network_resources(network=True, subnet=True)
|
|
||||||
super(BaseSecurityGroupsTest, cls).setup_credentials()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generate_random_security_group_id():
|
def generate_random_security_group_id():
|
||||||
if (CONF.service_available.neutron and
|
if (CONF.service_available.neutron and
|
||||||
|
|
|
@ -26,6 +26,7 @@ CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class DeleteServersTestJSON(base.BaseV2ComputeTest):
|
class DeleteServersTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
# NOTE: Server creations of each test class should be under 10
|
# NOTE: Server creations of each test class should be under 10
|
||||||
# for preventing "Quota exceeded for instances"
|
# for preventing "Quota exceeded for instances"
|
||||||
|
|
|
@ -24,6 +24,7 @@ CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
|
class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
|
|
|
@ -19,6 +19,7 @@ from tempest.lib import decorators
|
||||||
|
|
||||||
|
|
||||||
class InstanceActionsTestJSON(base.BaseV2ComputeTest):
|
class InstanceActionsTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
|
|
|
@ -20,6 +20,7 @@ from tempest.lib import exceptions as lib_exc
|
||||||
|
|
||||||
|
|
||||||
class InstanceActionsNegativeTestJSON(base.BaseV2ComputeTest):
|
class InstanceActionsNegativeTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
|
|
|
@ -20,6 +20,7 @@ from tempest.lib import exceptions as lib_exc
|
||||||
|
|
||||||
|
|
||||||
class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
|
|
|
@ -19,6 +19,7 @@ from tempest.lib import decorators
|
||||||
|
|
||||||
|
|
||||||
class MultipleCreateTestJSON(base.BaseV2ComputeTest):
|
class MultipleCreateTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@decorators.idempotent_id('61e03386-89c3-449c-9bb1-a06f423fd9d1')
|
@decorators.idempotent_id('61e03386-89c3-449c-9bb1-a06f423fd9d1')
|
||||||
def test_multiple_create(self):
|
def test_multiple_create(self):
|
||||||
|
|
|
@ -33,6 +33,7 @@ else:
|
||||||
|
|
||||||
|
|
||||||
class NoVNCConsoleTestJSON(base.BaseV2ComputeTest):
|
class NoVNCConsoleTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
|
|
|
@ -19,12 +19,7 @@ from tempest.lib import decorators
|
||||||
|
|
||||||
|
|
||||||
class ServerAddressesTestJSON(base.BaseV2ComputeTest):
|
class ServerAddressesTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
# This test module might use a network and a subnet
|
|
||||||
cls.set_network_resources(network=True, subnet=True)
|
|
||||||
super(ServerAddressesTestJSON, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
|
|
|
@ -20,11 +20,7 @@ from tempest.lib import exceptions as lib_exc
|
||||||
|
|
||||||
|
|
||||||
class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
|
class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources(network=True, subnet=True)
|
|
||||||
super(ServerAddressesNegativeTestJSON, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
|
|
|
@ -29,6 +29,7 @@ class ServerGroupTestJSON(base.BaseV2ComputeTest):
|
||||||
policies = affinity/anti-affinity
|
policies = affinity/anti-affinity
|
||||||
It also adds the tests for list and get details of server-groups
|
It also adds the tests for list and get details of server-groups
|
||||||
"""
|
"""
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
|
|
|
@ -18,6 +18,7 @@ from tempest.lib import decorators
|
||||||
|
|
||||||
|
|
||||||
class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
class ServerMetadataTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
|
|
|
@ -26,6 +26,8 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
|
||||||
min_microversion = '2.26'
|
min_microversion = '2.26'
|
||||||
max_microversion = 'latest'
|
max_microversion = 'latest'
|
||||||
|
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def skip_checks(cls):
|
def skip_checks(cls):
|
||||||
super(ServerTagsTestJSON, cls).skip_checks()
|
super(ServerTagsTestJSON, cls).skip_checks()
|
||||||
|
|
|
@ -25,6 +25,7 @@ CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class ServersTestJSON(base.BaseV2ComputeTest):
|
class ServersTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
|
|
|
@ -30,6 +30,7 @@ CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class ServersNegativeTestJSON(base.BaseV2ComputeTest):
|
class ServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||||
|
create_default_network = True
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ServersNegativeTestJSON, self).setUp()
|
super(ServersNegativeTestJSON, self).setUp()
|
||||||
|
@ -46,11 +47,6 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
|
||||||
# server_check_teardown should be called after super's tearDown.
|
# server_check_teardown should be called after super's tearDown.
|
||||||
self.server_check_teardown()
|
self.server_check_teardown()
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
cls.set_network_resources(network=True, subnet=True)
|
|
||||||
super(ServersNegativeTestJSON, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(ServersNegativeTestJSON, cls).setup_clients()
|
super(ServersNegativeTestJSON, cls).setup_clients()
|
||||||
|
|
|
@ -32,11 +32,7 @@ class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
|
||||||
|
|
||||||
depends_on_nova_network = True
|
depends_on_nova_network = True
|
||||||
|
|
||||||
@classmethod
|
create_default_network = True
|
||||||
def setup_credentials(cls):
|
|
||||||
# This test needs a network and a subnet
|
|
||||||
cls.set_network_resources(network=True, subnet=True)
|
|
||||||
super(VirtualInterfacesTestJSON, cls).setup_credentials()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
|
|
Loading…
Reference in New Issue