Skip to content

Commit bc262e2

Browse files
committed
prepare tests don't do multiple attemps local.
1 parent a0b90f7 commit bc262e2

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

bin/install-package-tests

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,29 @@ fi
8787

8888
echo 'Checking if MySQL is ready...'
8989

90-
MYSQL_TRIES=36
91-
MYSQL_WAIT=5
90+
if [ -z "$PS1" ]; then
91+
# These vars are because github actions gave problems in the past.
92+
MYSQL_TRIES=36
93+
MYSQL_WAIT=5
94+
else
95+
MYSQL_TRIES=1
96+
MYSQL_WAIT=0
97+
fi
98+
9299
while ! mysql ${HOST_STRING} --user="${USER}" "${PASSWORD_STRING}" --execute="SHOW DATABASES;" | grep 'information_schema' >/dev/null;
93100
do
94-
echo "Waiting for MySQL(${i}/${MYSQL_TRIES})..."
95-
sleep ${MYSQL_WAIT}
96-
i=$((i+1))
97-
if [ $i -gt $MYSQL_TRIES ]; then
98-
echo "${C_RED}MySQL failed to start. Aborting.${NO_FORMAT}"
99-
echo "Cannot connect to mysql server. For all available variables, check the documentation at:"
100-
echo " ${C_BLUE}https://github.com/wp-cli/wp-cli-tests?tab=readme-ov-file#the-database-credentials${NO_FORMAT}"
101-
exit 1
102-
fi
101+
i=$((i+1))
102+
if [ "${MYSQL_TRIES}" -gt 1 ]; then
103+
echo "Waiting for MySQL(${i}/${MYSQL_TRIES})..."
104+
sleep ${MYSQL_WAIT}
105+
fi
106+
107+
if [ $i -ge $MYSQL_TRIES ]; then
108+
echo "${C_RED}MySQL failed to start. Aborting.${NO_FORMAT}"
109+
echo "Cannot connect to mysql server. For all available variables, check the documentation at:"
110+
echo " ${C_BLUE}https://github.com/wp-cli/wp-cli-tests?tab=readme-ov-file#the-database-credentials${NO_FORMAT}"
111+
exit 1
112+
fi
103113
done
104114

105115
# Prepare the database for running the tests with a MySQL version 8.0 or higher.
@@ -134,7 +144,6 @@ esac
134144

135145
echo "Detected ${TYPE} at version ${MAJOR}.${MINOR}"
136146

137-
138147
if [ "${TYPE}" != "MariaDB" ] && [ "${MAJOR}" -ge 8 ]; then
139148
install_mysql_db_8_0_plus
140149
else

0 commit comments

Comments
 (0)