fix: use ./... in CI and restore local dev host connection
Backend Tests / test (push) Successful in 1m3s
Backend Tests / test (push) Successful in 1m3s
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.
This commit is contained in:
@@ -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
|
||||
|
||||
+2
-2
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user