Merged in feature/listtypes (pull request #23)

Feature/listtypes

* started

* cleanuplist

* someunittestfixes

* removemostflakiness
This commit is contained in:
Michael McGuinness
2025-01-15 12:19:49 +00:00
parent 7da57058d4
commit 5ca36b0502
38 changed files with 532 additions and 366 deletions
+7 -7
View File
@@ -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)
}
}