Calculate the number of resources based on number of networks

Can have 2 (public,shared) or 1 (public)

Change-Id: Id6dd338fe32b5fb7d838525551fa876e40ceb604
This commit is contained in:
Eyal 2020-05-11 08:27:29 +03:00
parent 83eac6f6d9
commit 9c31548478
2 changed files with 9 additions and 1 deletions

View File

@ -25,6 +25,7 @@ from vitrage_tempest_plugin.tests.common.constants import \
NOVA_INSTANCE_DATASOURCE
from vitrage_tempest_plugin.tests.common.constants import VertexProperties as \
VProps
from vitrage_tempest_plugin.tests.common import neutron_utils
from vitrage_tempest_plugin.tests.common import nova_utils
from vitrage_tempest_plugin.tests import utils
from vitrageclient.exceptions import ClientException
@ -75,7 +76,9 @@ 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)
self.assertThat(resources, matchers.HasLength(7))
has_shared_network = neutron_utils.get_shared_network()
num_resources = 7 if has_shared_network else 6
self.assertThat(resources, matchers.HasLength(num_resources))
@utils.tempest_logger
def test_resource_list_with_all_tenants(self):

View File

@ -18,3 +18,8 @@ from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients
def get_public_network():
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')