neutron: Allow to run networking test multiple times

Adjust NeutronNetworkingTest to optionally run tearDown and
re-use existing instances on subsequent runs.

tearDown is controlled through a key under the `tests_options`
dictionary in tests.yaml.

Useful for morphing a deployment and then validating connectivity
for existing instances afterwards.
This commit is contained in:
Frode Nordahl
2020-06-24 10:57:31 +02:00
parent fe329c1824
commit f33d166c5e

View File

@@ -794,11 +794,22 @@ class NeutronNetworkingTest(NeutronNetworkingBase):
"""Ensure that openstack instances have valid networking."""
def test_instances_have_networking(self):
"""Validate North/South and East/West networking."""
self.launch_guests()
"""Validate North/South and East/West networking.
Tear down can optionally be disabled by setting the module path +
class name + run_tearDown key under the `tests_options` key in
tests.yaml.
Abbreviated example:
...charm_tests.neutron.tests.NeutronNetworkingTest.run_tearDown: false
"""
instance_1, instance_2 = self.retrieve_guests()
if not all([instance_1, instance_2]):
self.launch_guests()
instance_1, instance_2 = self.retrieve_guests()
self.check_connectivity(instance_1, instance_2)
self.run_resource_cleanup = True
self.run_resource_cleanup = self.get_my_tests_options(
'run_resource_cleanup', True)
class NeutronNetworkingVRRPTests(NeutronNetworkingBase):