Skip to content

Commit bbe928d

Browse files
committed
fix(ci): test-backend can't resolve postgres service DNS on Gitea runner
The Gitea deploy workflow's test-backend job ran inside a container: (gitea/runner-images:ubuntu-latest) and addressed the DB by its Docker service name (POSTGRES_HOST: postgres). The Gitea act_runner does not reliably wire up service-container DNS, so every test ERROR'd at setup with "could not translate host name postgres to address: Temporary failure in name resolution" — the autouse conftest migration fixture (connects to settings.POSTGRES_HOST) failed before any test ran. Fix: drop the container: block so the job runs directly on the runner host, add ports: mappings to the postgres + redis services, and connect via localhost — mirroring the proven .github/workflows/test.yml pattern. If the job is ever moved back into a container:, revert POSTGRES_HOST to 'postgres' and drop the ports: (Docker service-name DNS resolves inside a container job on runners that link services correctly).
1 parent 56e2276 commit bbe928d

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.gitea/workflows/deploy.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,24 @@ jobs:
4343
test-backend:
4444
name: Run Backend Pytest Suite
4545
runs-on: ubuntu-latest
46-
container:
47-
# Pulled from Docker Hub; docker.gitea.com times out from the runner host.
48-
image: gitea/runner-images:ubuntu-latest
4946
services:
5047
postgres:
5148
image: timescale/timescaledb:latest-pg14
5249
env:
5350
POSTGRES_DB: health_assistant_test
5451
POSTGRES_USER: admin
5552
POSTGRES_PASSWORD: password
53+
ports:
54+
- 5432:5432
5655
options: >-
5756
--health-cmd "pg_isready -U admin -d health_assistant_test"
5857
--health-interval 10s
5958
--health-timeout 5s
6059
--health-retries 5
6160
redis:
6261
image: redis:7-alpine
62+
ports:
63+
- 6379:6379
6364
options: >-
6465
--health-cmd "redis-cli ping"
6566
--health-interval 10s
@@ -85,12 +86,18 @@ jobs:
8586
env:
8687
# Configure via parts (not DATABASE_URL) so config.py assembles the
8788
# URL and the b13 security-hygiene tests exercise POSTGRES_PASSWORD.
89+
# No `container:` block → the job runs directly on the runner host,
90+
# so services are reached via localhost (their published ports),
91+
# NOT the Docker service-name DNS ("postgres") which the Gitea
92+
# act_runner does not reliably resolve. Mirrors .github/workflows/
93+
# test.yml. If this job is ever moved back into a `container:`,
94+
# switch POSTGRES_HOST back to "postgres" + drop the `ports:`.
8895
POSTGRES_USER: admin
8996
POSTGRES_PASSWORD: password
90-
POSTGRES_HOST: postgres
97+
POSTGRES_HOST: localhost
9198
POSTGRES_PORT: 5432
9299
POSTGRES_DB: health_assistant_test
93-
REDIS_URL: redis://redis:6379
100+
REDIS_URL: redis://localhost:6379
94101
run: |
95102
cd backend
96103
# Mirror production Docker PYTHONPATH (/app/backend:/app) so the

0 commit comments

Comments
 (0)