17 lines
757 B
Bash
Executable File
17 lines
757 B
Bash
Executable File
#!/bin/sh
|
|
# A unique disposable Compose project; never touches normal project volumes.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
project="mtusi-lab3-migration-check-$$"
|
|
if [ -n "$(docker compose -p "$project" ps -aq)" ]; then
|
|
echo 'Refusing to reuse a pre-existing scratch project' >&2
|
|
exit 1
|
|
fi
|
|
cleanup() {
|
|
docker compose -p "$project" down --volumes >/dev/null 2>&1
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
docker compose -p "$project" up -d --wait --wait-timeout 90 postgres redis
|
|
docker compose -p "$project" run --rm --no-deps api sh -c 'python -m messenger.migrate && python -m messenger.migrate && python -m pytest student-tests -q -o cache_dir=/tmp/pytest-cache'
|
|
echo 'PASS: migrations and application tests on fresh disposable PostgreSQL and Redis volumes.'
|