Enhance the DB connection check.
This commit is based on one of the commits by Michal Schorm <mschorm@redhat.com>. Thanks! * https://src.fedoraproject.org/rpms/rubygem-mysql2/pull-request/13 - [5/6] Testsuite fix - enhance the error handling of the loop that checks whether the DB server is alive * https://bugzilla.redhat.com/show_bug.cgi?id=2144488#c2 - (3) While waiting for the DB server to come online In the previous logic, the DB connection logic didn't exit correctly with error when the last 10th try still fails. The new logic makes the logic fail properly, and prints the DB error log file. The printed log makes us debug easily.
This commit is contained in:
parent
b5062f7590
commit
8b771a1ea9
@ -125,13 +125,20 @@ mysql_install_db \
|
||||
--port="${MYSQL_TEST_PORT}" \
|
||||
--ssl &
|
||||
|
||||
conn_found=false
|
||||
for i in $(seq 10); do
|
||||
echo "Waiting for the DB server to accept connections... ${i}"
|
||||
sleep 1
|
||||
if grep -q 'ready for connections.' "${MYSQL_TEST_LOG}"; then
|
||||
if grep -q 'ready for connections' "${MYSQL_TEST_LOG}"; then
|
||||
conn_found=true
|
||||
break
|
||||
fi
|
||||
echo "Waiting connections... ${i}"
|
||||
done
|
||||
if ! "${conn_found}"; then
|
||||
echo "ERROR: Failed to connect the DB server."
|
||||
cat "${MYSQL_TEST_LOG}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Reset password for the root user due to MariaDB 10.4 authentication change.
|
||||
# See https://mariadb.com/kb/en/authentication-from-mariadb-104/#altering-the-user-account-to-revert-to-the-previous-authentication-method
|
||||
|
Loading…
Reference in New Issue
Block a user