diff --git a/mongo/Makefile b/mongo/Makefile index 0220da57596bff0e9967cf3364fd02693438eb3e..57972833f026f9cb736ec37f8584c94f742a6a85 100644 --- a/mongo/Makefile +++ b/mongo/Makefile @@ -4,9 +4,17 @@ BENCHTIME ?= 10s build: go build && go install -test: +require-client: + if [ -z "$$(which mongo)" ]; then \ + echo 'Missing "mongo" command. Please install the MongoDB client and try again.' && \ + exit 1; \ + fi + +reset-db: require-client + +test: reset-db go test -v $(MAKE) -C _example -bench: +bench: reset-db go test -v -test.bench=. -test.benchtime=$(BENCHTIME) -benchmem diff --git a/mongo/_dumps/Makefile b/mongo/_dumps/Makefile index 62addbe19d6924405bb449b58e70469c2c9fc0d7..4089f4910436301990f64d64d86fb48c27f73d1c 100644 --- a/mongo/_dumps/Makefile +++ b/mongo/_dumps/Makefile @@ -1,10 +1,4 @@ all: setup -require-client: - if [ -z "$(which mongo)" ]; then \ - echo 'Missing "mongo" command. Please install the MongoDB client and try again.' && \ - exit 1; \ - fi - -setup: require-client +setup: mongo upperio_tests --eval 'db.addUser("upperio_tests", "upperio_secret")' diff --git a/mysql/Makefile b/mysql/Makefile index 3cc1a8ab3403833c6130becfffa39a7c67bbe653..f1e74863e149ab48f8f0210e353f58f63cafde0b 100644 --- a/mysql/Makefile +++ b/mysql/Makefile @@ -5,7 +5,7 @@ build: go build && go install require-client: - if [ -z "$(which mysql)" ]; then \ + if [ -z "$$(which mysql)" ]; then \ echo 'Missing "mysql" command. Please install the MySQL client and try again.' && \ exit 1; \ fi diff --git a/postgresql/Makefile b/postgresql/Makefile index 6d2ef94788b7240dfa27a4c499dd0c4acb91e403..66a685c6c3cc2141d683337be326652b1eaf2919 100644 --- a/postgresql/Makefile +++ b/postgresql/Makefile @@ -5,7 +5,7 @@ build: go build && go install require-client: - if [ -z "$(which psql)" ]; then \ + if [ -z "$$(which psql)" ]; then \ echo 'Missing "psql" command. Please install the PostgreSQL client and try again.' && \ exit 1; \ fi diff --git a/ql/Makefile b/ql/Makefile index aeca3fddb99cca9ff5878c86a61bc6ee8e78cf83..ad7b312194691a15945bf439f59ab8306416b70d 100644 --- a/ql/Makefile +++ b/ql/Makefile @@ -4,7 +4,7 @@ build: go build && go install require-client: - if [ -z "$(which ql)" ]; then \ + if [ -z "$$(which ql)" ]; then \ echo 'Missing "ql" command. Please install the QL cli tool and try again.' && \ exit 1; \ fi diff --git a/sqlite/Makefile b/sqlite/Makefile index a539ab2c8a3c2d77ca65bc91957ff69b74fe9531..61017f6a3e116e57e10e0bfa216037251cc19195 100644 --- a/sqlite/Makefile +++ b/sqlite/Makefile @@ -4,7 +4,7 @@ build: go build && go install require-client: - if [ -z "$(which sqlite3)" ]; then \ + if [ -z "$$(which sqlite3)" ]; then \ echo 'Missing "sqlite3" command. Please install SQLite3 and try again.' && \ exit 1; \ fi