fix(local-dev): pin test env vars to explicit values
Backend Tests / test (push) Successful in 59s

The test command (line 1478) inherits the tmux environment, which
includes POSTGRES_HOST=postgres from line 112 (sourced from .env).
Since db_dev.go now reads POSTGRES_HOST from env, the test runner
tried connecting to 'postgres:5432' which doesn't resolve from the
host — causing all TestMain functions to fail.

Fix: export explicit values (myuser/mypassword/localhost/crussell_test)
instead of re-exporting whatever the tmux session inherited.
This commit is contained in:
2026-06-25 12:18:26 +01:00
parent 1b982b118b
commit d2f5c25b3d
+1 -1
View File
@@ -1472,7 +1472,7 @@ read -r
echo -e "${C_GREEN}⏳ Running tests...${C_RESET}" echo -e "${C_GREEN}⏳ Running tests...${C_RESET}"
cd /home/popertots/Crussell/backend cd /home/popertots/Crussell/backend
export POSTGRES_USER POSTGRES_PASSWORD POSTGRES_HOST POSTGRES_DB GO_TESTING=1 export POSTGRES_USER=myuser POSTGRES_PASSWORD=mypassword POSTGRES_HOST=localhost POSTGRES_DB=crussell_test GO_TESTING=1
TEST_OUTPUT_FILE=$(mktemp) TEST_OUTPUT_FILE=$(mktemp)
START_TIME=$(date +%s) START_TIME=$(date +%s)
go test -tags "test,dev" -v -count=1 ./... 2>&1 | tee "$TEST_OUTPUT_FILE" || true go test -tags "test,dev" -v -count=1 ./... 2>&1 | tee "$TEST_OUTPUT_FILE" || true