Skip to content

Commit 2f5263e

Browse files
committed
chore: use testcontainers-go in postgres store
1 parent 2f17493 commit 2f5263e

File tree

5 files changed

+325
-53
lines changed

5 files changed

+325
-53
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ jobs:
3434
image: 'memcached:latest'
3535
ports:
3636
- '11211:11211'
37-
postgres:
38-
image: 'postgres:latest'
39-
ports:
40-
- '5432:5432'
41-
env:
42-
POSTGRES_DB: fiber
43-
POSTGRES_USER: username
44-
POSTGRES_PASSWORD: "pass#w%rd"
4537
options: >-
4638
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
4739
--health-retries 5
@@ -120,15 +112,13 @@ jobs:
120112
done
121113
shell: bash
122114
env:
123-
POSTGRES_DATABASE: fiber
124-
POSTGRES_USERNAME: username
125-
POSTGRES_PASSWORD: "pass#w%rd"
126115
TEST_CLICKHOUSE_IMAGE: "clickhouse/clickhouse-server:23-alpine"
127116
TEST_COUCHBASE_IMAGE: "couchbase:enterprise-7.1.1"
128117
TEST_MINIO_IMAGE: "docker.io/minio/minio:RELEASE.2024-08-17T01-24-54Z"
129118
TEST_MONGODB_IMAGE: "docker.io/mongo:7"
130119
TEST_MSSQL_IMAGE: "mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04"
131120
TEST_MYSQL_IMAGE: "docker.io/mysql:9"
121+
TEST_POSTGRES_IMAGE: "docker.io/postgres:16-alpine"
132122

133123
- name: Get Previous Benchmark Results
134124
uses: actions/cache@v4

.github/workflows/test-postgres.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ name: "Tests Postgres"
1212
jobs:
1313
Tests:
1414
runs-on: ubuntu-latest
15-
services:
16-
postgres:
17-
image: 'postgres:latest'
18-
ports:
19-
- '5432:5432'
20-
env:
21-
POSTGRES_DB: fiber
22-
POSTGRES_USER: username
23-
POSTGRES_PASSWORD: "pass#w%rd"
24-
options: >-
25-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
26-
--health-retries 5
2715
strategy:
2816
matrix:
2917
go-version:
@@ -38,8 +26,6 @@ jobs:
3826
with:
3927
go-version: '${{ matrix.go-version }}'
4028
- name: Run Test
41-
run: cd ./postgres && go test ./... -v -race
4229
env:
43-
POSTGRES_DATABASE: fiber
44-
POSTGRES_USERNAME: username
45-
POSTGRES_PASSWORD: "pass#w%rd"
30+
TEST_POSTGRES_IMAGE: "docker.io/postgres:16-alpine"
31+
run: cd ./postgres && go test ./... -v -race

postgres/go.mod

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,67 @@
11
module github.com/gofiber/storage/postgres/v3
22

3-
go 1.20
3+
go 1.21
4+
5+
toolchain go1.22.4
46

57
require (
68
github.com/jackc/pgx/v5 v5.6.0
79
github.com/stretchr/testify v1.9.0
10+
github.com/testcontainers/testcontainers-go v0.33.0
11+
github.com/testcontainers/testcontainers-go/modules/postgres v0.33.0
812
)
913

1014
require (
15+
dario.cat/mergo v1.0.0 // indirect
16+
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
17+
github.com/Microsoft/go-winio v0.6.2 // indirect
18+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
19+
github.com/containerd/containerd v1.7.18 // indirect
20+
github.com/containerd/log v0.1.0 // indirect
21+
github.com/containerd/platforms v0.2.1 // indirect
22+
github.com/cpuguy83/dockercfg v0.3.1 // indirect
1123
github.com/davecgh/go-spew v1.1.1 // indirect
24+
github.com/distribution/reference v0.6.0 // indirect
25+
github.com/docker/docker v27.1.1+incompatible // indirect
26+
github.com/docker/go-connections v0.5.0 // indirect
27+
github.com/docker/go-units v0.5.0 // indirect
28+
github.com/felixge/httpsnoop v1.0.4 // indirect
29+
github.com/go-logr/logr v1.4.1 // indirect
30+
github.com/go-logr/stdr v1.2.2 // indirect
31+
github.com/go-ole/go-ole v1.2.6 // indirect
32+
github.com/gogo/protobuf v1.3.2 // indirect
33+
github.com/google/uuid v1.6.0 // indirect
1234
github.com/jackc/pgpassfile v1.0.0 // indirect
1335
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
1436
github.com/jackc/puddle/v2 v2.2.1 // indirect
15-
github.com/kr/text v0.2.0 // indirect
37+
github.com/klauspost/compress v1.17.4 // indirect
38+
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
39+
github.com/magiconair/properties v1.8.7 // indirect
40+
github.com/moby/docker-image-spec v1.3.1 // indirect
41+
github.com/moby/patternmatcher v0.6.0 // indirect
42+
github.com/moby/sys/sequential v0.5.0 // indirect
43+
github.com/moby/sys/user v0.1.0 // indirect
44+
github.com/moby/term v0.5.0 // indirect
45+
github.com/morikuni/aec v1.0.0 // indirect
46+
github.com/opencontainers/go-digest v1.0.0 // indirect
47+
github.com/opencontainers/image-spec v1.1.0 // indirect
48+
github.com/pkg/errors v0.9.1 // indirect
1649
github.com/pmezard/go-difflib v1.0.0 // indirect
50+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
1751
github.com/rogpeppe/go-internal v1.11.0 // indirect
18-
golang.org/x/crypto v0.23.0 // indirect
52+
github.com/shirou/gopsutil/v3 v3.23.12 // indirect
53+
github.com/shoenig/go-m1cpu v0.1.6 // indirect
54+
github.com/sirupsen/logrus v1.9.3 // indirect
55+
github.com/tklauser/go-sysconf v0.3.12 // indirect
56+
github.com/tklauser/numcpus v0.6.1 // indirect
57+
github.com/yusufpapurcu/wmi v1.2.3 // indirect
58+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
59+
go.opentelemetry.io/otel v1.24.0 // indirect
60+
go.opentelemetry.io/otel/metric v1.24.0 // indirect
61+
go.opentelemetry.io/otel/trace v1.24.0 // indirect
62+
golang.org/x/crypto v0.24.0 // indirect
1963
golang.org/x/sync v0.7.0 // indirect
20-
golang.org/x/text v0.15.0 // indirect
64+
golang.org/x/sys v0.21.0 // indirect
65+
golang.org/x/text v0.16.0 // indirect
2166
gopkg.in/yaml.v3 v3.0.1 // indirect
2267
)

0 commit comments

Comments
 (0)