fix: wait only for port for sql server
This commit is contained in:
parent
b407ad3755
commit
2134fae875
1 changed files with 12 additions and 8 deletions
|
@ -2,11 +2,9 @@ package sql_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/maxatome/go-testdeep/td"
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
|
@ -40,9 +38,12 @@ func PreparePostgresContainer(tb testing.TB) (name string, cfg *config.Server) {
|
|||
"POSTGRES_PASSWORD": dbPassword,
|
||||
"POSTGRES_DB": dbName,
|
||||
},
|
||||
WaitingFor: wait.ForSQL(postgresPort, "pgx", func(port nat.Port) string {
|
||||
return fmt.Sprintf("postgres://%s:%s@localhost:%d/%s", dbUser, dbPassword, port.Int(), dbName)
|
||||
}),
|
||||
WaitingFor: wait.ForAll(
|
||||
wait.ForListeningPort(postgresPort),
|
||||
/*wait.ForSQL(postgresPort, "pgx", func(port nat.Port) string {
|
||||
return fmt.Sprintf("postgres://%s:%s@localhost:%d/%s", dbUser, dbPassword, port.Int(), dbName)
|
||||
}),*/
|
||||
),
|
||||
},
|
||||
Started: true,
|
||||
Logger: testcontainers.TestLogger(tb),
|
||||
|
@ -92,9 +93,12 @@ func PrepareMariaDBContainer(tb testing.TB) (name string, cfg *config.Server) {
|
|||
"MARIADB_RANDOM_ROOT_PASSWORD": "1",
|
||||
"MARIADB_DATABASE": dbName,
|
||||
},
|
||||
WaitingFor: wait.ForSQL(mysqlPort, "mysql", func(port nat.Port) string {
|
||||
return fmt.Sprintf("%s:%s@tcp(localhost:%d)/%s", dbUser, dbPassword, port.Int(), dbName)
|
||||
}),
|
||||
WaitingFor: wait.ForAll(
|
||||
wait.ForListeningPort(mysqlPort),
|
||||
/* wait.ForSQL(mysqlPort, "mysql", func(port nat.Port) string {
|
||||
return fmt.Sprintf("%s:%s@tcp(localhost:%d)/%s", dbUser, dbPassword, port.Int(), dbName)
|
||||
}),*/
|
||||
),
|
||||
},
|
||||
Started: true,
|
||||
Logger: testcontainers.TestLogger(tb),
|
||||
|
|
Loading…
Reference in a new issue