From 85dfd559d9a9bb4a54471ef78435f16868b46293 Mon Sep 17 00:00:00 2001 From: Ygal Blum Date: Fri, 22 Mar 2019 15:54:32 -0400 Subject: [PATCH] is_container_ready should return False if container was not found Currently it raises an exception and as a result wait_for_services fails immediately if it runs before the containers are running --- docker_test_tools/environment.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker_test_tools/environment.py b/docker_test_tools/environment.py index f2db357..32d7835 100644 --- a/docker_test_tools/environment.py +++ b/docker_test_tools/environment.py @@ -229,7 +229,10 @@ def is_container_ready(self, name): :param str name: container name as it appears in the docker compose file. """ - status_output = self.inspect_container(name)['State'] + try: + status_output = self.inspect_container(name)['State'] + except RuntimeError: + return False if 'Health' in status_output: is_ready = status_output['Health']['Status'] == "healthy"