From 1b982b118b39180fa87bcbb78fe68f088444bb3b Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Thu, 25 Jun 2026 12:11:45 +0100 Subject: [PATCH] fix: use ./... in CI and restore local dev host connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI test command: switch from explicit package list to ./... so new packages are automatically included. local-dev-2.sh: override POSTGRES_HOST=localhost for the host-side go run -tags dev ./main.go. The dev-tagged Connect() now reads POSTGRES_HOST from env (needed for CI where service containers use Docker DNS). Locally, .env sets POSTGRES_HOST=postgres, but that name only resolves inside Docker — not from the host where the dev server runs. Override to localhost so it connects via Docker's port forwarding. --- .gitea/workflows/backend-tests.yaml | 2 +- local-dev-2.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/backend-tests.yaml b/.gitea/workflows/backend-tests.yaml index d24b6bc..e108ce3 100644 --- a/.gitea/workflows/backend-tests.yaml +++ b/.gitea/workflows/backend-tests.yaml @@ -60,7 +60,7 @@ jobs: - name: Test (all packages) working-directory: backend - run: go test -tags "test,dev" -count=1 -v -timeout 120s ./handlers/... ./auth/... ./mw/... ./internal/... ./db/... + run: go test -tags "test,dev" -count=1 -v -timeout 180s ./... env: POSTGRES_HOST: postgres TEST_DB_HOST: postgres diff --git a/local-dev-2.sh b/local-dev-2.sh index d100ac1..a21c8a3 100755 --- a/local-dev-2.sh +++ b/local-dev-2.sh @@ -131,7 +131,7 @@ tmux select-pane -t $SESSION_NAME:0.0 -T "DB" # Pane 1: Backend (Split Horizontally) tmux split-window -v -t $SESSION_NAME -tmux send-keys -t $SESSION_NAME "set -a; source .env > /dev/null 2>&1; cd backend && go run -tags dev ./main.go" Enter +tmux send-keys -t $SESSION_NAME "set -a; source .env > /dev/null 2>&1; cd backend && POSTGRES_HOST=localhost go run -tags dev ./main.go" Enter tmux select-pane -t $SESSION_NAME:0.1 -T "Backend" # Pane 2: Frontend (Split Vertically from Backend) @@ -1475,7 +1475,7 @@ cd /home/popertots/Crussell/backend export POSTGRES_USER POSTGRES_PASSWORD POSTGRES_HOST POSTGRES_DB GO_TESTING=1 TEST_OUTPUT_FILE=$(mktemp) START_TIME=$(date +%s) - go test -tags "test,dev" -v -count=1 -parallel 8 ./... 2>&1 | tee "$TEST_OUTPUT_FILE" || true + go test -tags "test,dev" -v -count=1 ./... 2>&1 | tee "$TEST_OUTPUT_FILE" || true END_TIME=$(date +%s) DURATION=$((END_TIME - START_TIME)) MINUTES=$((DURATION / 60))