diff --git a/bin/install-package-tests b/bin/install-package-tests index 9ed4dbc3..c1cf6a27 100755 --- a/bin/install-package-tests +++ b/bin/install-package-tests @@ -47,6 +47,18 @@ if [ -n "${WP_CLI_TEST_DBPASS}" ]; then TEST_PASSWORD="${WP_CLI_TEST_DBPASS}" fi +echo 'Checking if MySQL is ready...' +while ! mysql --user="${USER}" "${PASSWORD_STRING}" --execute="SHOW DATABASES;" | grep 'information_schema' >/dev/null; +do + echo 'Waiting for MySQL...' + sleep 5 + let "i+=1" + if [ $i -gt 36 ]; then + echo 'MySQL failed to start. Aborting.' + exit 1 + fi +done + # Prepare the database for running the tests with a MySQL version 8.0 or higher. install_mysql_db_8_0_plus() { set -ex