From d781636f320ed70e5d1638f75f91b179b8f73f85 Mon Sep 17 00:00:00 2001 From: Laurent Indermuehle Date: Fri, 9 Dec 2022 14:09:07 +0100 Subject: [PATCH] Add healthcheck to MariaDB before starting the tests This prevent the first test to fail because the db isn't ready yet. --- Makefile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 26a78ce..9fca9de 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,14 @@ -.PHONY: test-integration-ansible-2-11-python-3-8-mariadb-10-5 -test-integration-ansible-2-11-python-3-8-mariadb-10-5: - podman run --detach --name mariadb105 --env MARIADB_ROOT_PASSWORD=msandbox --publish 3307:3306 mariadb:10.5 - ansible-test integration --docker --python 3.8 test_mysql_user +.PHONY: test-integration-mariadb-10-5 +test-integration-mariadb-10-5: + podman run \ + --detach \ + --name mariadb105 \ + --env MARIADB_ROOT_PASSWORD=msandbox \ + --network podman \ + --publish 3307:3306 \ + --health-cmd 'mysqladmin ping -P 3306 -pmsandbox | grep alive || exit 1' \ + mariadb:10.5 + while ! podman healthcheck run mariadb105 && [[ "$$SECONDS" -lt 120 ]]; do sleep 1; done + -ansible-test integration test_mysql_db --venv + podman stop --time 0 --ignore mariadb105 + podman rm --ignore mariadb105