#!/bin/bash -ex # on macs, you may need to: # export GOBUILDFLAG=-ldflags -linkmode=external echo "Running unit tests" go test -race echo "Testing against postgres" export SQLDB_TEST_DSN="host=127.0.0.1 user=testuser password=123 dbname=testdb sslmode=disable" export SQLDB_TEST_DIALECT=postgres go test -tags integration $GOBUILDFLAG $@ . echo "Testing against sqlite" export SQLDB_TEST_DSN=/tmp/testdb.bin export SQLDB_TEST_DIALECT=sqlite go test -tags integration $GOBUILDFLAG $@ . rm -f /tmp/testdb.bin echo "Testing against mysql" # export SQLDB_TEST_DSN="testuser:123@tcp(127.0.0.1:3306)/testdb?charset=utf8mb4&parseTime=True&loc=Local" export SQLDB_TEST_DSN="testuser:123@tcp(127.0.0.1:3306)/testdb" export SQLDB_TEST_DIALECT=mysql go test -tags integration $GOBUILDFLAG $@ .