2021-08-20 18:00:45 +08:00
|
|
|
# Run tests
|
|
|
|
|
2022-05-01 23:38:14 +08:00
|
|
|
# Delete the test DB if it isn't properly removed
|
2022-01-25 01:05:06 +08:00
|
|
|
docker rm -f sl-test-db
|
|
|
|
|
2022-05-01 23:38:14 +08:00
|
|
|
# Create a test DB
|
2021-08-20 18:00:45 +08:00
|
|
|
docker run -d --name sl-test-db -e POSTGRES_PASSWORD=test -e POSTGRES_USER=test -e POSTGRES_DB=test -p 15432:5432 postgres:13
|
|
|
|
|
2022-05-01 23:38:14 +08:00
|
|
|
# the time for the test DB container to start
|
2022-02-04 05:11:42 +08:00
|
|
|
sleep 3
|
2022-01-25 01:05:06 +08:00
|
|
|
|
2022-05-01 23:38:14 +08:00
|
|
|
# migrate the DB to the latest version
|
|
|
|
CONFIG=tests/test.env poetry run alembic upgrade head
|
|
|
|
|
|
|
|
# run test
|
2022-05-20 20:45:33 +08:00
|
|
|
poetry run pytest -c pytest.ci.ini
|
2021-08-20 18:00:45 +08:00
|
|
|
|
2022-05-01 23:38:14 +08:00
|
|
|
# Delete the test DB
|
2022-02-04 05:08:38 +08:00
|
|
|
docker rm -f sl-test-db
|