fix(smoke): load staging env before migrate/smoke checks (refs #130 #90)
All checks were successful
CI / test-and-quality (push) Successful in 1m35s
CI / test-and-quality (pull_request) Successful in 1m36s

This commit is contained in:
2026-02-28 16:35:25 +00:00
parent 30e3f1c77f
commit 8b6f115759

View File

@@ -50,16 +50,26 @@ PY
echo "[smoke] healthz check: ${BASE_URL}/healthz" echo "[smoke] healthz check: ${BASE_URL}/healthz"
curl -fsS "${BASE_URL}/healthz" >/dev/null || { SMOKE_FAIL_MESSAGE="healthz check failed" fail "healthz check failed"; } curl -fsS "${BASE_URL}/healthz" >/dev/null || { SMOKE_FAIL_MESSAGE="healthz check failed" fail "healthz check failed"; }
ENV_FILE="${ENV_FILE:-/etc/wpp/staging.env}"
run_manage() {
local cmd="$1"
(
cd "${APP_DIR}"
if [[ -f "${ENV_FILE}" ]]; then
set -a
# shellcheck disable=SC1090
source "${ENV_FILE}"
set +a
fi
.venv/bin/python manage.py ${cmd}
)
}
echo "[smoke] migration consistency check" echo "[smoke] migration consistency check"
( run_manage "migrate --check --noinput" || { SMOKE_FAIL_MESSAGE="schema drift: unapplied migrations in staging" fail "schema drift: unapplied migrations in staging"; }
cd "${APP_DIR}"
.venv/bin/python manage.py migrate --check --noinput
) || { SMOKE_FAIL_MESSAGE="schema drift: unapplied migrations in staging" fail "schema drift: unapplied migrations in staging"; }
echo "[smoke] gameplay flow via management command" echo "[smoke] gameplay flow via management command"
( run_manage "smoke_staging" || { SMOKE_FAIL_MESSAGE="manage.py smoke_staging failed" fail "manage.py smoke_staging failed"; }
cd "${APP_DIR}"
.venv/bin/python manage.py smoke_staging
) || { SMOKE_FAIL_MESSAGE="manage.py smoke_staging failed" fail "manage.py smoke_staging failed"; }
echo "[smoke] OK" echo "[smoke] OK"