fix(store): postgres.BasicWaitStrategies() — устраняет flaky first-run на macOS
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user