Add support for running integration tests with dockerized test databases.
This commit is contained in:
parent
4d5abc85c6
commit
972fc1d9bf
13 changed files with 210 additions and 67 deletions
50
tests/Makefile
Normal file
50
tests/Makefile
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
|
||||
|
||||
setup: checkout-testdata docker-compose-up
|
||||
|
||||
# checkout-testdata will checkout testdata from separate repository into git submodule.
|
||||
checkout-testdata:
|
||||
git submodule init
|
||||
git submodule update
|
||||
cd ./testdata && git fetch && git checkout master && git pull
|
||||
|
||||
# docker-compose-up will download docker image for each of the databases listed in docker-compose.yaml file, and then it will initialize
|
||||
# database with testdata retrieved in previous step.
|
||||
# On the first run this action might take couple of minutes. Docker temp data are stored in .docker directory.
|
||||
docker-compose-up:
|
||||
docker-compose up
|
||||
|
||||
|
||||
# jet-gen will call generator on each of the test databases to generate sql builder and model files need to run the tests.
|
||||
jet-gen: install-jet-gen jet-gen-pg jet-gen-mysql jet-gen-mariadb jet-gen-sqlite
|
||||
|
||||
install-jet-gen:
|
||||
go build -o ${GOPATH}/bin/jet ../cmd/jet/
|
||||
|
||||
jet-gen-pg:
|
||||
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=dvds -path=./.gentestdata/
|
||||
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=chinook -path=./.gentestdata/
|
||||
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=chinook2 -path=./.gentestdata/
|
||||
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=test_sample -path=./.gentestdata/
|
||||
|
||||
jet-gen-mysql:
|
||||
jet -source=mysql -dsn="jet:jet@tcp(localhost:50902)/dvds" -path=./.gentestdata/mysql
|
||||
jet -source=mysql -dsn="jet:jet@tcp(localhost:50902)/dvds2" -path=./.gentestdata/mysql
|
||||
jet -source=mysql -dsn="jet:jet@tcp(localhost:50902)/test_sample" -path=./.gentestdata/mysql
|
||||
|
||||
jet-gen-mariadb:
|
||||
jet -source=mariadb -dsn="jet:jet@tcp(localhost:50903)/dvds" -path=./.gentestdata/mysql
|
||||
jet -source=mariadb -dsn="jet:jet@tcp(localhost:50903)/dvds2" -path=./.gentestdata/mysql
|
||||
jet -source=mariadb -dsn="jet:jet@tcp(localhost:50903)/test_sample" -path=./.gentestdata/mysql
|
||||
|
||||
jet-gen-sqlite:
|
||||
jet -source=sqlite -dsn="./testdata/init/sqlite/chinook.db" -schema=dvds -path=./.gentestdata/sqlite/chinook
|
||||
jet -source=sqlite -dsn="./testdata/init/sqlite/sakila.db" -schema=dvds -path=./.gentestdata/sqlite/sakila
|
||||
jet -source=sqlite -dsn="./testdata/init/sqlite/test_sample.db" -schema=dvds -path=./.gentestdata/sqlite/test_sample
|
||||
|
||||
|
||||
# docker-compose-cleanup will stop and remove test containers, volumes, and images.
|
||||
# If temp .docker/ folder is still not empty, use 'sudo rm -rf .docker' to remove it.
|
||||
cleanup:
|
||||
docker-compose down --volumes
|
||||
$(info INFO: If the ./.docker folder is still not empty, use 'sudo rm -rf .docker/' to remove it.)
|
||||
Loading…
Add table
Add a link
Reference in a new issue