Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cli/clitest/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"os/exec"
"testing"
"time"

"github.com/google/uuid"
"github.com/oullin/database"
Expand All @@ -18,8 +19,12 @@ func MakeTestConnection(t *testing.T, models ...interface{}) *database.Connectio
if _, err := exec.LookPath("docker"); err != nil {
t.Skip("docker not installed")
}
if err := exec.Command("docker", "ps").Run(); err != nil {
t.Skip("docker not running")
}

ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

pg, err := postgres.RunContainer(ctx,
testcontainers.WithImage("postgres:16-alpine"),
Expand All @@ -31,7 +36,7 @@ func MakeTestConnection(t *testing.T, models ...interface{}) *database.Connectio
if err != nil {
t.Fatalf("container run err: %v", err)
}
t.Cleanup(func() { pg.Terminate(ctx) })
t.Cleanup(func() { pg.Terminate(context.Background()) })

host, err := pg.Host(ctx)
if err != nil {
Expand Down
9 changes: 7 additions & 2 deletions database/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"os/exec"
"testing"
"time"

"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/postgres"
Expand All @@ -17,8 +18,12 @@ func TestApiKeysWithTestContainer(t *testing.T) {
if _, err := exec.LookPath("docker"); err != nil {
t.Skip("docker not installed")
}
if err := exec.Command("docker", "ps").Run(); err != nil {
t.Skip("docker not running")
}

ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

pg, err := postgres.RunContainer(ctx,
testcontainers.WithImage("postgres:16-alpine"),
Expand All @@ -32,7 +37,7 @@ func TestApiKeysWithTestContainer(t *testing.T) {
t.Fatalf("container run err: %v", err)
}

t.Cleanup(func() { pg.Terminate(ctx) })
t.Cleanup(func() { pg.Terminate(context.Background()) })

host, err := pg.Host(ctx)

Expand Down
9 changes: 7 additions & 2 deletions database/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"os/exec"
"testing"
"time"

"github.com/google/uuid"
"github.com/testcontainers/testcontainers-go"
Expand All @@ -18,8 +19,12 @@ func setupDB(t *testing.T) *database.Connection {
if _, err := exec.LookPath("docker"); err != nil {
t.Skip("docker not installed")
}
if err := exec.Command("docker", "ps").Run(); err != nil {
t.Skip("docker not running")
}

ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

pg, err := postgres.RunContainer(ctx,
testcontainers.WithImage("postgres:16-alpine"),
Expand All @@ -33,7 +38,7 @@ func setupDB(t *testing.T) *database.Connection {
t.Fatalf("container run err: %v", err)
}

t.Cleanup(func() { pg.Terminate(ctx) })
t.Cleanup(func() { pg.Terminate(context.Background()) })

host, err := pg.Host(ctx)

Expand Down
9 changes: 7 additions & 2 deletions database/seeder/seeds/seeder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"os/exec"
"testing"
"time"

"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/postgres"
Expand All @@ -16,8 +17,12 @@ func testConnection(t *testing.T, e *env.Environment) *database.Connection {
if _, err := exec.LookPath("docker"); err != nil {
t.Skip("docker not installed")
}
if err := exec.Command("docker", "ps").Run(); err != nil {
t.Skip("docker not running")
}

ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

pg, err := postgres.RunContainer(ctx,
testcontainers.WithImage("postgres:16-alpine"),
Expand All @@ -31,7 +36,7 @@ func testConnection(t *testing.T, e *env.Environment) *database.Connection {
t.Fatalf("container run err: %v", err)
}

t.Cleanup(func() { pg.Terminate(ctx) })
t.Cleanup(func() { pg.Terminate(context.Background()) })

host, err := pg.Host(ctx)

Expand Down
34 changes: 18 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ module github.com/oullin

go 1.24

// Dependencies updated to latest releases
require (
github.com/getsentry/sentry-go v0.34.1
github.com/getsentry/sentry-go v0.35.0
github.com/go-playground/validator/v10 v10.27.0
github.com/google/uuid v1.6.0
github.com/joho/godotenv v1.5.1
Expand All @@ -16,14 +17,14 @@ require (
golang.org/x/text v0.27.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/postgres v1.6.0
gorm.io/gorm v1.30.0
gorm.io/gorm v1.30.1
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
dario.cat/mergo v1.0.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
Expand All @@ -39,10 +40,11 @@ require (
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.5 // indirect
Expand All @@ -51,38 +53,38 @@ require (
github.com/jinzhu/now v1.1.5 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/go-archive v0.1.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
github.com/moby/sys/user v0.4.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/moby/term v0.5.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/shirou/gopsutil/v4 v4.25.5 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/shirou/gopsutil/v4 v4.25.7 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/testify v1.10.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.10.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.34.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
google.golang.org/grpc v1.74.2 // indirect
google.golang.org/protobuf v1.36.6 // indirect
)

Expand Down
Loading
Loading