test: wait like the postgres module and use PG 18 - #201
Merged
Merged
Conversation
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why
Main's
Buildfailed ingo-check / Integration TestwithFATAL: 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.postgres:16-alpine→postgres:18-alpine, the major the cluster (CNPG 18.1) and local-stack run.go mod tidy:testcontainers-gobecomes 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=integrationis clean.Part of duynhlab/homelab#1107 (G2).