Skip to content

Commit c75d220

Browse files
committed
Adjust test script
1 parent 4733d8e commit c75d220

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
# 214 = Grants dump failed
1818
# 215 = Grants list failed
1919

20-
MYSQL_HOST="localhost"
21-
MYSQL_USER="root"
22-
MYSQL_PASS="testbench"
20+
TEST_MYSQL_HOST="${TEST_MYSQL_HOST:-localhost}"
21+
TEST_MYSQL_USER="${TEST_MYSQL_USER:-root}"
22+
TEST_MYSQL_PASS="${TEST_MYSQL_PASS:-}"
23+
TEST_MYSQL_PORT="${TEST_MYSQL_PORT:-3306}"
2324
SCRIPT_ROOT="$(dirname $0)"
2425
echo "SCRIPT_ROOT=${SCRIPT_ROOT}"
25-
MYSQLCREDS="-h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS}"
26+
MYSQLCREDS="${MYSQLCREDS:---host ${TEST_MYSQL_HOST} -u${TEST_MYSQL_USER} -p${TEST_MYSQL_PASS} --port ${TEST_MYSQL_PORT}}"
2627

2728
compareFiles() {
2829
compareFilesOrExit "${SCRIPT_ROOT}/samples/$1/structure.sql" "${SCRIPT_ROOT}/test/structure.sql"
@@ -70,9 +71,10 @@ testBACKUP_CONFIG_ENVFILE_Fail() {
7071
}
7172

7273
fillConfigFile() {
73-
echo "MYSQL_HOST=${MYSQL_HOST}" >> $1
74-
echo "MYSQL_USER=${MYSQL_USER}" >> $1
75-
echo "MYSQL_PASS=${MYSQL_PASS}" >> $1
74+
echo "MYSQL_HOST=${TEST_MYSQL_HOST}" >> $1
75+
echo "MYSQL_USER=${TEST_MYSQL_USER}" >> $1
76+
echo "MYSQL_PASS=${TEST_MYSQL_PASS}" >> $1
77+
echo "MYSQL_PORT=${TEST_MYSQL_PORT}" >> $1
7678
echo "SKIP_DATABASES=mysql,sys,information_schema,performance_schema" >> $1
7779
}
7880

@@ -390,5 +392,5 @@ testNoSkipDatabases() {
390392
mysql ${MYSQLCREDS} < "${SCRIPT_ROOT}/samples/empty/deleteuser.sql"
391393
postTest
392394
}
393-
395+
export SHUNIT_COLOR="none" # GitHub actions
394396
. ./shunit2-2.1.7/shunit2

0 commit comments

Comments
 (0)