Skip to content

Commit

Permalink
Improve test.sh wrapper (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislas-m authored Jun 3, 2019
1 parent def18b1 commit 96a54f4
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
#!/bin/bash

########################################################
# test.sh is a wrapper to execute integration tests for
# pop.
########################################################

set -e
clear

verbose=""

echo $@
VERBOSE=""
DEBUG='NO'

if [[ "$@" == "-v" ]]
then
verbose="-v"
fi
for i in "$@"
do
case $i in
-v)
VERBOSE="-v"
shift
;;
-d)
DEBUG='YES'
shift
;;
*)
# unknown option
;;
esac
done

function cleanup {
echo "Cleanup resources..."
Expand All @@ -31,26 +48,32 @@ function test {
echo "!!! Testing $1"
export SODA_DIALECT=$1
echo ./tsoda -v
echo "Setup..."
./tsoda drop -e $SODA_DIALECT -c ./database.yml
./tsoda create -e $SODA_DIALECT -c ./database.yml
./tsoda migrate -e $SODA_DIALECT -c ./database.yml
go test -race -tags sqlite $verbose $(go list ./... | grep -v /vendor/)
echo "Test..."
go test -race -tags sqlite $VERBOSE ./... -count=1
}

function debug_test {
echo "!!! Debug Testing $1"
export SODA_DIALECT=$1
echo ./tsoda -v
echo "Setup..."
./tsoda drop -e $SODA_DIALECT -c ./database.yml
./tsoda create -e $SODA_DIALECT -c ./database.yml
./tsoda migrate -e $SODA_DIALECT -c ./database.yml
echo "Test and debug..."
dlv test github.com/gobuffalo/pop
}

dialects=("postgres" "cockroach" "mysql" "sqlite")

for dialect in "${dialects[@]}" ; do
if [ $DEBUG = 'NO' ]; then
test ${dialect}
else
debug_test ${dialect}
fi
done

# debug_test "postgres"

0 comments on commit 96a54f4

Please sign in to comment.