diff --git a/vitrage_tempest_plugin/tests/api/resources/test_resources.py b/vitrage_tempest_plugin/tests/api/resources/test_resources.py index 55625c9..635dc0d 100644 --- a/vitrage_tempest_plugin/tests/api/resources/test_resources.py +++ b/vitrage_tempest_plugin/tests/api/resources/test_resources.py @@ -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 diff --git a/vitrage_tempest_plugin/tests/common/neutron_utils.py b/vitrage_tempest_plugin/tests/common/neutron_utils.py index 6dc29d7..190acd3 100644 --- a/vitrage_tempest_plugin/tests/common/neutron_utils.py +++ b/vitrage_tempest_plugin/tests/common/neutron_utils.py @@ -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) diff --git a/vitrage_tempest_plugin/tests/common/nova_utils.py b/vitrage_tempest_plugin/tests/common/nova_utils.py index 1ec80ce..8a3a9fa 100644 --- a/vitrage_tempest_plugin/tests/common/nova_utils.py +++ b/vitrage_tempest_plugin/tests/common/nova_utils.py @@ -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']}]