Skip to content

test: wait like the postgres module and use PG 18 - #201

Merged
duynhne merged 1 commit into
mainfrom
chore/testcontainers-pg18-wait
Oct 1, 2026
Merged

duynhne merged 1 commit into
mainfrom
chore/testcontainers-pg18-wait

Conversation

@duynhne

@duynhne duynhne commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Why

Main's Build failed in go-check / Integration Test with FATAL: the database system is starting up (SQLSTATE 57P03) (user-service, 2026-10-01).

The harness waited only for the port. The postgres image starts the server twice, so a test can connect during the restart. Six fleet repos had that wait; four waited for the second ready line only.

What

  • postgres.BasicWaitStrategies() from testcontainers-go v0.44.0: it waits for the second "ready to accept connections" line, then for the published port. Same fix in all 10 service repos.
  • Test image postgres:16-alpine → postgres:18-alpine, the major the cluster (CNPG 18.1) and local-stack run.
  • go mod tidy: testcontainers-go becomes indirect.

Test-only. The shipped binary does not change.

Verified locally (go1.27.1)

go test -count=1 -tags=integration ./internal/core/repository/... passes on PG 18, no skips; go vet -tags=integration is clean.

Part of duynhlab/homelab#1107 (G2).

The integration harness waited only for 5432 to listen. The postgres
entrypoint starts the server twice, so a test could connect during
the restart and fail with "the database system is starting up"
(SQLSTATE 57P03); main's Build hit it on 2026-10-01.
postgres.BasicWaitStrategies() waits for the second ready line and
then for the published port, which is the module's own answer.

The test image moves from postgres:16-alpine to postgres:18-alpine,
the major the cluster (CNPG 18.1) and local-stack run, so the SQL is
tested on the engine it ships against. testcontainers-go itself
becomes an indirect dependency.
@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

@duynhne
duynhne merged commit bb6c9f8 into main Oct 1, 2026
12 checks passed
@duynhne
duynhne deleted the chore/testcontainers-pg18-wait branch October 1, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant