From f33d166c5e1e44d8b6dc75120855f2b4612da3bb Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Wed, 24 Jun 2020 10:57:31 +0200 Subject: [PATCH] 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. --- zaza/openstack/charm_tests/neutron/tests.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index 5d2f019..2747569 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -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):