From c48801d2027c4d7d3cf9afd7adf0915d65fb05cd Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Mon, 13 Jan 2020 15:26:00 +0100 Subject: [PATCH] Allow us to retry the Manila client connection It is possible that Manila looks ready before it is, so we should retry a bit to ensure that the APi service is really down before giving up --- zaza/openstack/charm_tests/manila/tests.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/manila/tests.py b/zaza/openstack/charm_tests/manila/tests.py index 54f7ade..a3365de 100644 --- a/zaza/openstack/charm_tests/manila/tests.py +++ b/zaza/openstack/charm_tests/manila/tests.py @@ -16,6 +16,7 @@ """Encapsulate Manila testing.""" +from tenacity import Retrying, stop_after_attempt, wait_exponential from manilaclient import client as manilaclient @@ -38,4 +39,7 @@ class ManilaTests(test_utils.OpenStackBaseTest): def test_manila_api(self): """Test that the Manila API is working.""" # now just try a list the shares - self.manila_client.shares.list() + for attempt in Retrying( + stop=stop_after_attempt(3), + wait=wait_exponential(multiplier=1, min=2, max=10)): + self.manila_client.shares.list()