Merged in bugfix/cleanup (pull request #10)

Clean Up Testing and Linting

* somescriptcleanup

* mostgolangci

* deplatest

* imageversions

* usingscratch

* movedqueuefrtesting

* finishedunittesting

* linting

* taskfilecontext
This commit is contained in:
Michael McGuinness
2025-01-10 11:12:03 +00:00
parent 57764272c3
commit 0ebb8a21a1
62 changed files with 940 additions and 357 deletions
+16 -3
View File
@@ -14,7 +14,12 @@ import (
"github.com/testcontainers/testcontainers-go/wait"
)
func createDB(t *testing.T, ctx context.Context) (*pgxpool.Pool, testcontainers.Container) {
type db struct {
pool *pgxpool.Pool
container *testcontainers.Container
}
func createDB(t *testing.T, ctx context.Context) (*db, func()) {
port, err := nat.NewPort("tcp", "5432")
if err != nil {
t.Fatalf("Failed to create port: %v", err)
@@ -25,7 +30,7 @@ func createDB(t *testing.T, ctx context.Context) (*pgxpool.Pool, testcontainers.
user := "postgres"
req := testcontainers.ContainerRequest{
Image: "postgres:latest",
Image: "postgres:17.2-alpine3.21",
Env: map[string]string{
"POSTGRES_DB": name,
"POSTGRES_USER": user,
@@ -65,5 +70,13 @@ func createDB(t *testing.T, ctx context.Context) (*pgxpool.Pool, testcontainers.
pool := database.GetDBPool(ctx)
return pool, container
return &db{
pool: pool,
container: &container,
}, func() {
err := container.Terminate(ctx)
if err != nil {
t.Error(err)
}
}
}