Merged in feature/listtypes (pull request #23)
Feature/listtypes * started * cleanuplist * someunittestfixes * removemostflakiness
This commit is contained in:
@@ -29,7 +29,6 @@ type Database struct {
|
||||
type CreateDatabaseConfig struct {
|
||||
Network *testcontainers.DockerNetwork
|
||||
Migrations *database.MigrationConfig
|
||||
NoPool bool
|
||||
}
|
||||
|
||||
func CreateDB(t *testing.T, ctx context.Context, cfg *CreateDatabaseConfig) (*Database, func()) {
|
||||
@@ -52,8 +51,11 @@ func CreateDB(t *testing.T, ctx context.Context, cfg *CreateDatabaseConfig) (*Da
|
||||
"POSTGRES_PASSWORD": pass,
|
||||
},
|
||||
ExposedPorts: []string{port.Port()},
|
||||
// WaitingFor: wait.ForLog("database system is ready to accept connections"),
|
||||
WaitingFor: wait.ForExposedPort(),
|
||||
WaitingFor: wait.ForAll(
|
||||
wait.ForExposedPort(),
|
||||
wait.ForListeningPort(port),
|
||||
wait.ForLog("database system is ready to accept connections"),
|
||||
),
|
||||
}
|
||||
|
||||
if cfg.Network != nil {
|
||||
@@ -87,17 +89,15 @@ func CreateDB(t *testing.T, ctx context.Context, cfg *CreateDatabaseConfig) (*Da
|
||||
t.Setenv("DB_NAME", name)
|
||||
t.Setenv("DB_NOSSL", "1")
|
||||
|
||||
var pool *pgxpool.Pool
|
||||
if cfg.Migrations != nil {
|
||||
database.RunMigrations(ctx, cfg.Migrations)
|
||||
}
|
||||
|
||||
var pool *pgxpool.Pool
|
||||
if !cfg.NoPool {
|
||||
pool = database.GetDBPool(ctx)
|
||||
|
||||
err = pool.Ping(ctx)
|
||||
if err != nil {
|
||||
t.Fatal("Unable to ping database")
|
||||
t.Fatalf("Unable to ping database: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user