Update subnet test to not use pre-created share network
This pathc updates 'test_delete_contains_shares' to not use
pre-created share network since the test may fail to delete the
share server and the share network subnet if more shares were
created using the same share network, by other concurrent tests.
Change-Id: I950560ac8040e8deadd21f869f04416153fd8a88
diff --git a/manila_tempest_tests/tests/api/test_share_network_subnets_negative.py b/manila_tempest_tests/tests/api/test_share_network_subnets_negative.py
index 7cedc07..aa9ce67 100644
--- a/manila_tempest_tests/tests/api/test_share_network_subnets_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_network_subnets_negative.py
@@ -202,20 +202,32 @@
@testtools.skipIf(not CONF.share.multitenancy_enabled,
'Can run only with drivers that do handle share servers '
'creation. Skipping.')
+ @testtools.skipIf(CONF.share.share_network_id != "",
+ "This test is not suitable for pre-existing "
+ "share_network.")
def test_delete_contains_shares(self):
# Get a compatible availability zone
az = self.get_availability_zones_matching_share_type(
self.share_type)[0]
- share_network = self.shares_v2_client.get_share_network(
+ original_share_network = self.shares_v2_client.get_share_network(
self.shares_v2_client.share_network_id
)
+ share_net_info = (
+ utils.share_network_get_default_subnet(original_share_network))
+ share_network = self.create_share_network(
+ neutron_net_id=share_net_info['neutron_net_id'],
+ neutron_subnet_id=share_net_info['neutron_subnet_id'],
+ )
+ share_network = self.shares_v2_client.get_share_network(
+ share_network['id']
+ )
share_network_id = share_network['id']
- subnet = utils.share_network_get_default_subnet(share_network)
+ default_subnet = share_network['share_network_subnets'][0]
# Generate subnet data
- data = {'neutron_net_id': subnet['neutron_net_id'],
- 'neutron_subnet_id': subnet['neutron_subnet_id'],
+ data = {'neutron_net_id': default_subnet['neutron_net_id'],
+ 'neutron_subnet_id': default_subnet['neutron_subnet_id'],
'share_network_id': share_network_id,
'availability_zone': az}