diff --git a/tests/travis/install-mariadb.sh b/tests/travis/install-mariadb.sh index cda81e9bcba..b089c3b25fb 100644 --- a/tests/travis/install-mariadb.sh +++ b/tests/travis/install-mariadb.sh @@ -3,6 +3,7 @@ set -ex sudo docker run \ + --health-cmd='mysqladmin ping --silent' \ -d \ -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ -e MYSQL_DATABASE=doctrine_tests \ @@ -10,4 +11,8 @@ sudo docker run \ --name mariadb \ mariadb:${MARIADB_VERSION} -sudo docker exec -i mariadb bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done' +until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mariadb)" == "\"healthy\"" ] +do + echo "Waiting for MariaDB to become ready…" + sleep 1 +done diff --git a/tests/travis/install-mysql-5.7.sh b/tests/travis/install-mysql-5.7.sh index 25459382c6f..8967166635a 100644 --- a/tests/travis/install-mysql-5.7.sh +++ b/tests/travis/install-mysql-5.7.sh @@ -5,6 +5,7 @@ set -ex echo "Starting MySQL 5.7..." sudo docker run \ + --health-cmd='mysqladmin ping --silent' \ -d \ -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ -e MYSQL_DATABASE=doctrine_tests \ @@ -12,4 +13,8 @@ sudo docker run \ --name mysql57 \ mysql:5.7 -sudo docker exec -i mysql57 bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done' +until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mysql57)" == "\"healthy\"" ] +do + echo "Waiting for MySQL to become ready…" + sleep 1 +done diff --git a/tests/travis/install-mysql-8.0.sh b/tests/travis/install-mysql-8.0.sh index 952a4300ba7..79d72a263c8 100644 --- a/tests/travis/install-mysql-8.0.sh +++ b/tests/travis/install-mysql-8.0.sh @@ -6,6 +6,7 @@ echo "Starting MySQL 8.0..." sudo docker pull mysql:8.0 sudo docker run \ + --health-cmd='mysqladmin ping --silent' \ -d \ -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ -e MYSQL_DATABASE=doctrine_tests \ @@ -14,4 +15,8 @@ sudo docker run \ mysql:8.0 \ --default-authentication-plugin=mysql_native_password -sudo docker exec -i mysql80 bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done' +until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mysql80)" == "\"healthy\"" ] +do + echo "Waiting for MySQL to become ready…" + sleep 1 +done