Deploy Development / deploy (push) Failing after 40s
Testdaten entstehen nur dort und werden danach entfernt, damit Dev und Produktion sie nicht behalten. Co-authored-by: Cursor <cursoragent@cursor.com>
49 lines
1.2 KiB
Bash
49 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# Mandatory suite against a throwaway PostgreSQL. Never the dev or prod database.
|
|
set -euo pipefail
|
|
|
|
NAME="tsumugu-pytest-db"
|
|
cleanup() {
|
|
docker rm -f "$NAME" >/dev/null 2>&1 || true
|
|
}
|
|
cleanup
|
|
trap cleanup EXIT
|
|
|
|
docker run -d --name "$NAME" \
|
|
-e POSTGRES_USER=tsumugu \
|
|
-e POSTGRES_PASSWORD=pytest \
|
|
-e POSTGRES_DB=postgres \
|
|
postgres:16-alpine >/dev/null
|
|
|
|
ready=0
|
|
for _ in $(seq 1 40); do
|
|
if docker exec "$NAME" pg_isready -U tsumugu -d postgres >/dev/null 2>&1; then
|
|
ready=1
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
if [ "$ready" -ne 1 ]; then
|
|
echo "Kurzlebiges PostgreSQL ist nicht bereit."
|
|
exit 1
|
|
fi
|
|
|
|
docker run --rm --network "container:${NAME}" \
|
|
-e TSUMUGU_ENV=development \
|
|
-e TSUMUGU_TEST_HOST=127.0.0.1 \
|
|
-e TSUMUGU_TEST_PORT=5432 \
|
|
-e TSUMUGU_TEST_USER=tsumugu \
|
|
-e TSUMUGU_TEST_PASSWORD=pytest \
|
|
-e TSUMUGU_TEST_ADMIN_DB=postgres \
|
|
-e DB_HOST=127.0.0.1 \
|
|
-e DB_PORT=5432 \
|
|
-e DB_NAME=tsumugu_pytest \
|
|
-e DB_USER=tsumugu \
|
|
-e DB_PASSWORD=pytest \
|
|
-e ALLOWED_ORIGINS=http://testserver \
|
|
-e SEED_DEMO=false \
|
|
-v "$(pwd)/backend:/work" \
|
|
-w /work \
|
|
python:3.12-slim \
|
|
bash -c "pip install -q -r requirements-dev.txt && python -m pytest"
|