Ensure that private networks are also accounted
Right now there're 3 types of networks that are created in devstack: * private * public * shared This affects amount of resources that Vitrage is expecting to see during one of tests. In order to ensure that we're accounting for each type of networks that are present in deployment and that expected number of resources is evaluated properly, we add extra logic of fetching assumed networks and incrementing the counter. Change-Id: Ib30db71a97bd40c3a73082c348c9eaff3adc43db
This commit is contained in:
parent
a86db28d19
commit
f89426fc08
@ -76,8 +76,13 @@ class TestResource(BaseVitrageTempest):
|
||||
# TODO(e0ne): split this test to verify that only network,
|
||||
# instance and port are returned to non-admin user.
|
||||
resources = self.vitrage_client.resource.list(all_tenants=False)
|
||||
has_shared_network = neutron_utils.get_shared_network()
|
||||
num_resources = 7 if has_shared_network else 6
|
||||
has_shared_network = neutron_utils.get_neutron_network('shared')
|
||||
has_private_network = neutron_utils.get_neutron_network('private')
|
||||
num_resources = 6
|
||||
if has_shared_network:
|
||||
num_resources += 1
|
||||
if has_private_network:
|
||||
num_resources += 1
|
||||
self.assertThat(resources, matchers.HasLength(num_resources))
|
||||
|
||||
@utils.tempest_logger
|
||||
|
@ -15,11 +15,6 @@ from vitrage_tempest_plugin.tests.common import general_utils as g_utils
|
||||
from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients
|
||||
|
||||
|
||||
def get_public_network():
|
||||
def get_neutron_network(name):
|
||||
nets = TempestClients.neutron().list_networks()
|
||||
return g_utils.first_match(nets['networks'], name='public')
|
||||
|
||||
|
||||
def get_shared_network():
|
||||
nets = TempestClients.neutron().list_networks()
|
||||
return g_utils.first_match(nets['networks'], name='shared')
|
||||
return g_utils.first_match(nets['networks'], name=name)
|
||||
|
@ -29,7 +29,7 @@ def create_instances(num_instances=1, set_public_network=True, name='vm'):
|
||||
flavor = get_first_flavor()
|
||||
image = glance_utils.get_first_image()
|
||||
if set_public_network:
|
||||
public_net = neutron_utils.get_public_network()
|
||||
public_net = neutron_utils.get_neutron_network('public')
|
||||
if public_net:
|
||||
nics = [{'net-id': public_net['id']}]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user