From d2f5c25b3db1e42076504a919b09b59bd0387362 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Thu, 25 Jun 2026 12:18:26 +0100 Subject: [PATCH] fix(local-dev): pin test env vars to explicit values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- local-dev-2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local-dev-2.sh b/local-dev-2.sh index a21c8a3..f07d4b7 100755 --- a/local-dev-2.sh +++ b/local-dev-2.sh @@ -1472,7 +1472,7 @@ read -r echo -e "${C_GREEN}⏳ Running tests...${C_RESET}" 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) START_TIME=$(date +%s) go test -tags "test,dev" -v -count=1 ./... 2>&1 | tee "$TEST_OUTPUT_FILE" || true