From 8b6f11575963f8d29cf429c003b200df0367d52b Mon Sep 17 00:00:00 2001 From: Asger Geel Weirsoee Date: Sat, 28 Feb 2026 16:35:25 +0000 Subject: [PATCH] fix(smoke): load staging env before migrate/smoke checks (refs #130 #90) --- infra/staging/smoke_suite.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/infra/staging/smoke_suite.sh b/infra/staging/smoke_suite.sh index debd645..ca47bf5 100755 --- a/infra/staging/smoke_suite.sh +++ b/infra/staging/smoke_suite.sh @@ -50,16 +50,26 @@ PY echo "[smoke] healthz check: ${BASE_URL}/healthz" 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" -( - 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"; } +run_manage "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" -( - cd "${APP_DIR}" - .venv/bin/python manage.py smoke_staging -) || { SMOKE_FAIL_MESSAGE="manage.py smoke_staging failed" fail "manage.py smoke_staging failed"; } +run_manage "smoke_staging" || { SMOKE_FAIL_MESSAGE="manage.py smoke_staging failed" fail "manage.py smoke_staging failed"; } echo "[smoke] OK"