-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfa1759
commit a7f3881
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
# | ||
# Start/Stop test databases. | ||
# | ||
# Subcommands: | ||
# start <database-name>: Start a particular database. | ||
# stop <database-name>: Stop a particular database. | ||
# | ||
# Usage: | ||
# $ ./tools/db.sh start <database-name> | ||
# $ ./tools/db.sh stop <database-name> | ||
BASE_DIR=`dirname $0`/.. | ||
ALLOWED_DB=("postgresql" "mysql" "mssql" "sqlite3") | ||
|
||
if [[ ! " ${ALLOWED_DB[@]} " =~ " $2 " ]]; then | ||
echo "Error: Invalid database type. Allowed types are: ${ALLOWED_DB[@]}" | ||
exit 1 | ||
fi | ||
|
||
case "$1" in | ||
start) | ||
env $(cat "$BASE_DIR/.env.$2" | xargs) docker compose -f "$BASE_DIR/docker-compose.$2.yml" up -d | ||
;; | ||
stop) | ||
env $(cat "$BASE_DIR/.env.$2" | xargs) docker compose -f "$BASE_DIR/docker-compose.$2.yml" down | ||
;; | ||
*) | ||
echo "Error: Invalid command. Use 'start' or 'stop'." | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
# | ||
# Run tests against a particular database. | ||
# | ||
# Usage: | ||
# $ ./tools/test.sh <database-name> | ||
BASE_DIR=`dirname $0`/.. | ||
ALLOWED_DB=("postgresql" "mysql" "mssql" "sqlite3") | ||
|
||
if [[ ! " ${ALLOWED_DB[@]} " =~ " $1 " ]]; then | ||
echo "Error: Invalid database type. Allowed types are: ${ALLOWED_DB[@]}" | ||
exit 1 | ||
fi | ||
|
||
env $(cat "$BASE_DIR/.env.$1" | xargs) go test -p 1 -tags "$1" -cover ./... | ||
|