aboutsummaryrefslogtreecommitdiffstats
path: root/tools/test.sh
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2024-08-18 15:10:05 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2024-08-18 15:10:05 -0400
commita7f3881536b2fb56b10b74af32172227633bd691 (patch)
tree396f61f962ddf3af13b7ea1f13fa7a2948254ea5 /tools/test.sh
parentUpdate TOC in readme (diff)
downloadcli-a7f3881536b2fb56b10b74af32172227633bd691.zip
Add a couple helper scripts
Diffstat (limited to 'tools/test.sh')
-rwxr-xr-xtools/test.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/test.sh b/tools/test.sh
new file mode 100755
index 0000000..94826a9
--- /dev/null
+++ b/tools/test.sh
@@ -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 ./...
+