From 9c29d402698dc441557939b3aa4df9bcf119cdef Mon Sep 17 00:00:00 2001 From: Vassiliy Yegorov Date: Fri, 3 Jul 2026 14:04:23 +0700 Subject: [PATCH] =?UTF-8?q?fix(store):=20postgres.BasicWaitStrategies()=20?= =?UTF-8?q?=E2=80=94=20=D1=83=D1=81=D1=82=D1=80=D0=B0=D0=BD=D1=8F=D0=B5?= =?UTF-8?q?=D1=82=20flaky=20first-run=20=D0=BD=D0=B0=20macOS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- internal/store/testhelper_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/store/testhelper_test.go b/internal/store/testhelper_test.go index 8e2adf8..dda9cf9 100644 --- a/internal/store/testhelper_test.go +++ b/internal/store/testhelper_test.go @@ -3,11 +3,9 @@ package store import ( "context" "testing" - "time" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/modules/postgres" - "github.com/testcontainers/testcontainers-go/wait" ) // startPostgres spins up an ephemeral PostgreSQL, applies migrations, @@ -15,13 +13,13 @@ import ( func startPostgres(t *testing.T) string { t.Helper() ctx := context.Background() + // BasicWaitStrategies включает ForLog(...)x2 И ForListeningPort — второй + // критичен на macOS/Windows Docker Desktop (иначе flaky first-run). container, err := postgres.Run(ctx, "postgres:16-alpine", postgres.WithDatabase("dns_ar_test"), postgres.WithUsername("test"), postgres.WithPassword("test"), - testcontainers.WithWaitStrategy( - wait.ForLog("database system is ready to accept connections"). - WithOccurrence(2).WithStartupTimeout(60*time.Second)), + postgres.BasicWaitStrategies(), ) if err != nil { t.Fatalf("start postgres: %v", err)