Point the backend suite at the db container while the stack is up
The integrated stack drops every published host port, so make test-backend could not reach Postgres on localhost:5432 whenever the stack it shares a machine with was running. It now asks Docker where the container is; with the stack down, .env still stands. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H7LwYgJfpkbLCTeiAf8U4A
This commit is contained in:
@@ -69,8 +69,13 @@ generate-client: ## Regenerate the frontend SDK from the backend's OpenAPI sche
|
|||||||
|
|
||||||
test: test-backend test-frontend ## Run all tests (backend + frontend)
|
test: test-backend test-frontend ## Run all tests (backend + frontend)
|
||||||
|
|
||||||
|
# The integrated stack publishes no host port for Postgres (docker/compose.local.yml
|
||||||
|
# drops them all), so the suite reaches the container on the compose network
|
||||||
|
# instead. Empty when the stack is down — then .env's localhost:5432 stands.
|
||||||
|
DB_HOST = $(shell docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' fluksio-db 2>/dev/null | awk '{print $$1}')
|
||||||
|
|
||||||
test-backend: ## Run backend tests (pytest + coverage)
|
test-backend: ## Run backend tests (pytest + coverage)
|
||||||
cd backend && uv run bash scripts/tests-start.sh
|
cd backend && $(if $(DB_HOST),POSTGRES_SERVER=$(DB_HOST)) uv run bash scripts/tests-start.sh
|
||||||
|
|
||||||
test-frontend: ## Run frontend tests (Playwright e2e)
|
test-frontend: ## Run frontend tests (Playwright e2e)
|
||||||
cd frontend && bunx playwright test
|
cd frontend && bunx playwright test
|
||||||
|
|||||||
Reference in New Issue
Block a user