From e51b3c481dc05a99af4e398926d89d396d4a4200 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Wed, 13 Nov 2019 11:58:14 +0100 Subject: [PATCH] neutron: Add tenacity to retry ping It would be awesome if the first iteration of a ARP lookup, ICMP echo and ICMP reply on a newly created instance was always successful. Sadly this is not the reality. --- zaza/openstack/charm_tests/neutron/tests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index be20009..7433793 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -18,6 +18,7 @@ import logging +import tenacity import unittest import zaza @@ -175,6 +176,8 @@ class NeutronNetworkingTest(unittest.TestCase): self.validate_instance_can_reach_router(instance_1, verify) self.validate_instance_can_reach_router(instance_2, verify) + @tenacity.retry(wait=tenacity.wait_exponential(multiplier=1, max=60), + reraise=True, stop=tenacity.stop_after_attempt(8)) def validate_instance_can_reach_other(self, instance_1, instance_2, @@ -206,6 +209,8 @@ class NeutronNetworkingTest(unittest.TestCase): 'ping -c 1 {}'.format(floating_2), password=password, privkey=privkey, verify=verify) + @tenacity.retry(wait=tenacity.wait_exponential(multiplier=1, max=60), + reraise=True, stop=tenacity.stop_after_attempt(8)) def validate_instance_can_reach_router(self, instance, verify): """ Validate that an instance can reach it's primary gateway.