Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: no sleep (#15282)

p0ny4d510949b707
diff --git a/backend/tests/testcontainer.go b/backend/tests/testcontainer.go
index faf7ee7b8c..1b8e6e500f 100644
--- a/backend/tests/testcontainer.go
+++ b/backend/tests/testcontainer.go
@@ -44,7 +44,6 @@ func getMySQLContainer(ctx context.Context) (*Container, error) {
if err != nil {
return nil, err
}
- time.Sleep(10 * time.Second)
dsn := fmt.Sprintf("root:root-password@tcp(%s:%s)/?multiStatements=true", host, port.Port())
db, err := sql.Open("mysql", dsn)
@@ -71,7 +70,9 @@ func getPgContainer(ctx context.Context) (*Container, error) {
"POSTGRES_PASSWORD": "root-password",
},
ExposedPorts: []string{"5432/tcp"},
- WaitingFor: wait.ForListeningPort("5432/tcp"),
+ WaitingFor: wait.ForLog("database system is ready to accept connections").
+ WithOccurrence(2).
+ WithStartupTimeout(5 * time.Second),
}
c, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
@@ -91,7 +92,6 @@ func getPgContainer(ctx context.Context) (*Container, error) {
if err != nil {
return nil, err
}
- time.Sleep(10 * time.Second)
db, err := sql.Open("pgx", fmt.Sprintf("host=%s port=%s user=postgres password=root-password database=postgres", host, port.Port()))
if err != nil {