2021-12-17 16:59:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2021-12-18 13:55:40 +01:00
|
|
|
init-all:
|
|
|
|
|
go run ./init/init.go -testsuite all
|
|
|
|
|
|
|
|
|
|
init-postgres:
|
|
|
|
|
go run ./init/init.go -testsuite postgres
|
|
|
|
|
|
|
|
|
|
init-mysql:
|
|
|
|
|
go run ./init/init.go -testsuite mysql
|
|
|
|
|
|
|
|
|
|
init-mariadb:
|
|
|
|
|
go run ./init/init.go -testsuite mariadb
|
|
|
|
|
|
|
|
|
|
init-sqlite:
|
|
|
|
|
go run ./init/init.go -testsuite sqlite
|
2021-12-17 16:59:43 +01:00
|
|
|
|
|
|
|
|
# jet-gen will call generator on each of the test databases to generate sql builder and model files need to run the tests.
|
2021-12-18 13:55:40 +01:00
|
|
|
jet-gen-all: install-jet-gen jet-gen-postgres jet-gen-mysql jet-gen-mariadb jet-gen-sqlite
|
2021-12-17 16:59:43 +01:00
|
|
|
|
2022-05-06 11:54:44 +02:00
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
|
target := jet.exe
|
|
|
|
|
else
|
|
|
|
|
target := jet
|
|
|
|
|
endif
|
|
|
|
|
|
2021-12-17 16:59:43 +01:00
|
|
|
install-jet-gen:
|
2022-05-06 11:54:44 +02:00
|
|
|
go build -o ${GOPATH}/bin/${target} ../cmd/jet/
|
2021-12-17 16:59:43 +01:00
|
|
|
|
2021-12-18 13:55:40 +01:00
|
|
|
jet-gen-postgres:
|
2021-12-17 16:59:43 +01:00
|
|
|
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/
|
2022-05-05 13:01:42 +02:00
|
|
|
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=northwind -path=./.gentestdata/
|
2021-12-17 16:59:43 +01:00
|
|
|
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=test_sample -path=./.gentestdata/
|
2023-01-30 10:42:06 -05:00
|
|
|
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=test_generated -path=./.gentestdata/
|
2021-12-17 16:59:43 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2022-05-05 13:01:42 +02:00
|
|
|
jet-gen-cockroach:
|
|
|
|
|
jet -dsn=postgres://jet:jet@127.0.0.1:26257/jetdb?sslmode=disable -schema=dvds -path=./.gentestdata/
|
|
|
|
|
jet -dsn=postgres://jet:jet@localhost:26257/jetdb?sslmode=disable -schema=chinook -path=./.gentestdata/
|
|
|
|
|
jet -dsn=postgres://jet:jet@localhost:26257/jetdb?sslmode=disable -schema=chinook2 -path=./.gentestdata/
|
|
|
|
|
jet -dsn=postgres://jet:jet@localhost:26257/jetdb?sslmode=disable -schema=northwind -path=./.gentestdata/
|
|
|
|
|
jet -dsn=postgres://jet:jet@localhost:26257/jetdb?sslmode=disable -schema=test_sample -path=./.gentestdata/
|
2021-12-17 16:59:43 +01:00
|
|
|
|
|
|
|
|
# docker-compose-cleanup will stop and remove test containers, volumes, and images.
|
|
|
|
|
cleanup:
|
|
|
|
|
docker-compose down --volumes
|