Skip test_list_all_networks if no known network configured

If test_list_all_networks is run in an env without networks configured
then it will fail as it tries to assert that the list of networks are
not empty but actually it is empty.

So this PR skip the test if no known network is configured.

Note that the test API here is deprecated since Newton. So I did the
minimal effort to stabilize this test.

Change-Id: I5e0bc22da5281dec0e4679fcc3891f9c2e7cb770
This commit is contained in:
Balazs Gibizer 2023-05-23 09:40:54 +02:00
parent 4054e13e65
commit 0e8fcab930

View File

@ -64,5 +64,5 @@ class NetworksTest(base.BaseV2ComputeAdminTest):
configured_network = CONF.compute.fixed_network_name
self.assertIn(configured_network, [x['label'] for x in networks])
else:
network_labels = [x['label'] for x in networks]
self.assertNotEmpty(network_labels)
raise self.skipException(
"Environment has no known-for-sure existing network.")