Skip to content

Commit 8cad920

Browse files
committed
Fix do while
1 parent 3b98ebf commit 8cad920

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

bin/install-package-tests

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ if [[ "${TYPE}" == "MySQL" ]]; then
7575
else
7676
SERVER_VERSION=$(mariadb -e "SELECT VERSION()" --skip-column-names ${HOST_STRING} -u"${USER}" "${PASSWORD_STRING}")
7777
fi
78+
7879
VERSION=$(echo "${SERVER_VERSION}" | grep -o '^[^-]*')
7980
MAJOR=$(echo "${VERSION}" | cut -d. -f1)
8081
MINOR=$(echo "${VERSION}" | cut -d. -f2)
@@ -85,20 +86,28 @@ echo 'Checking if database is ready...'
8586

8687
if [[ "${TYPE}" == "MySQL" ]]; then
8788
while ! mysql ${HOST_STRING} --user="${USER}" "${PASSWORD_STRING}" --execute="SHOW DATABASES;" | grep 'information_schema' >/dev/null;
89+
do
90+
echo 'Waiting for database...'
91+
sleep 5
92+
i=$((i+1))
93+
if [ $i -gt 36 ]; then
94+
echo 'Database failed to start. Aborting.'
95+
exit 1
96+
fi
97+
done
8898
else
8999
while ! mariadb ${HOST_STRING} --user="${USER}" "${PASSWORD_STRING}" --execute="SHOW DATABASES;" | grep 'information_schema' >/dev/null;
100+
do
101+
echo 'Waiting for database...'
102+
sleep 5
103+
i=$((i+1))
104+
if [ $i -gt 36 ]; then
105+
echo 'Database failed to start. Aborting.'
106+
exit 1
107+
fi
108+
done
90109
fi
91110

92-
do
93-
echo 'Waiting for database...'
94-
sleep 5
95-
i=$((i+1))
96-
if [ $i -gt 36 ]; then
97-
echo 'Database failed to start. Aborting.'
98-
exit 1
99-
fi
100-
done
101-
102111
# Prepare the database for running the tests with a MySQL version 8.0 or higher.
103112
install_mysql_db_8_0_plus() {
104113
set -ex

0 commit comments

Comments
 (0)