Skip to content

Commit b3d35e9

Browse files
author
cg33
authored
Merge pull request #390 from wisarmy/master
refactor(make): Makefile mysql config extract
2 parents a797af5 + 22c3a89 commit b3d35e9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ TEST_CONFIG_SQLITE_PATH=./../../common/config_sqlite.json
1111
TEST_CONFIG_MS_PATH=./../../common/config_ms.json
1212
TEST_FRAMEWORK_DIR=./tests/frameworks
1313

14+
## database configs
15+
MYSQL_HOST = 127.0.0.1
16+
MYSQL_PORT = 3306
17+
MYSQL_USER = root
18+
MYSQL_PWD = root
19+
1420
all: test
1521

1622
## tests
@@ -73,8 +79,8 @@ import-sqlite:
7379
cp ./tests/data/admin.db ./tests/common/admin.db
7480

7581
import-mysql:
76-
mysql -uroot -proot -e "create database if not exists \`go-admin-test\`"
77-
mysql -uroot -proot go-admin-test < ./tests/data/admin.sql
82+
mysql -h$(MYSQL_HOST) -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PWD} -e "create database if not exists \`go-admin-test\`"
83+
mysql -h$(MYSQL_HOST) -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PWD} go-admin-test < ./tests/data/admin.sql
7884

7985
import-postgresql:
8086
dropdb -U postgres go-admin-test
@@ -148,4 +154,4 @@ cli:
148154
cp ./adm/build/windows/i386/adm_windows_i386_$(VERSION).zip ./adm/build/zip/
149155
cp ./adm/build/mac/adm_darwin_x86_64_$(VERSION).zip ./adm/build/zip/
150156

151-
.PHONY: all fmt golint govet cp-mod restore-mod test black-box-test mysql-test sqlite-test import-sqlite import-mysql import-postgresql pg-test fix-gf lint cilint cli
157+
.PHONY: all fmt golint govet cp-mod restore-mod test black-box-test mysql-test sqlite-test import-sqlite import-mysql import-postgresql pg-test fix-gf lint cilint cli

0 commit comments

Comments
 (0)