@@ -7,6 +7,7 @@ import (
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/serviceconfig/database"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
@@ -43,6 +44,12 @@ func CreateDB(t *testing.T, ctx context.Context, cfg *CreateDatabaseConfig) (tes
|
||||
wait.ForExposedPort(),
|
||||
wait.ForListeningPort(port),
|
||||
wait.ForLog("database system is ready to accept connections"),
|
||||
wait.ForSQL(port, "postgres", func(host string, port nat.Port) string {
|
||||
return fmt.Sprintf("postgres://%s:%s@localhost:%s/%s?sslmode=disable",
|
||||
user, pass, port.Port(), name)
|
||||
}).
|
||||
WithStartupTimeout(25*time.Second).
|
||||
WithPollInterval(10*time.Second),
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user