Skip to content

Commit d569495

Browse files
committed
feat: use testcontainers-go's nats module
1 parent c138cab commit d569495

File tree

10 files changed

+538
-85
lines changed

10 files changed

+538
-85
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,6 @@ jobs:
122122
run: |
123123
redis-server --port 6379 &
124124
125-
- name: Run NATS
126-
if: ${{ matrix.package == 'nats' }}
127-
run: |
128-
./.github/scripts/gen-test-certs.sh
129-
docker run -d --name nats-jetstream -p 4443:4443 -v ./nats/testdata:/testdata -v ./tls:/tls nats:latest --jetstream -c /testdata/nats-tls.conf
130-
sleep 2
131-
132125
- name: Run Benchmarks
133126
working-directory: ${{ matrix.package }}
134127
run: |
@@ -146,6 +139,7 @@ jobs:
146139
TEST_MINIO_IMAGE: "docker.io/minio/minio:RELEASE.2024-08-17T01-24-54Z"
147140
TEST_MONGODB_IMAGE: "docker.io/mongo:7"
148141
TEST_MYSQL_IMAGE: "docker.io/mysql:9"
142+
TEST_NATS_IMAGE: "nats:2-alpine"
149143
TEST_POSTGRES_IMAGE: "docker.io/postgres:16-alpine"
150144

151145
- name: Get Previous Benchmark Results

.github/workflows/test-nats.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
strategy:
1515
matrix:
1616
go-version:
17-
- 1.20.x
18-
- 1.21.x
1917
- 1.22.x
18+
- 1.23.x
19+
- 1.24.x
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Fetch Repository
@@ -25,11 +25,7 @@ jobs:
2525
uses: actions/setup-go@v5
2626
with:
2727
go-version: '${{ matrix.go-version }}'
28-
- name: Generate config
29-
run: ./.github/scripts/gen-test-certs.sh
30-
- name: Run NATS
31-
run: |
32-
docker run -d --name nats-jetstream -p 4443:4443 -v ./nats/testdata:/testdata -v ./tls:/tls nats:latest --jetstream -c /testdata/nats-tls.conf
33-
sleep 5
3428
- name: Test Nats
29+
env:
30+
TEST_NATS_IMAGE: "nats:2-alpine"
3531
run: cd ./nats && go test ./... -v -race

nats/go.mod

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,62 @@
11
module github.com/gofiber/storage/nats
22

3-
go 1.20
3+
go 1.22
44

55
require (
66
github.com/nats-io/nats.go v1.37.0
77
github.com/stretchr/testify v1.9.0
8+
github.com/testcontainers/testcontainers-go v0.35.0
9+
github.com/testcontainers/testcontainers-go/modules/nats v0.35.0
810
)
911

1012
require (
13+
dario.cat/mergo v1.0.0 // indirect
14+
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
15+
github.com/Microsoft/go-winio v0.6.2 // indirect
16+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
17+
github.com/containerd/containerd v1.7.18 // indirect
18+
github.com/containerd/log v0.1.0 // indirect
19+
github.com/containerd/platforms v0.2.1 // indirect
20+
github.com/cpuguy83/dockercfg v0.3.2 // indirect
1121
github.com/davecgh/go-spew v1.1.1 // indirect
12-
github.com/klauspost/compress v1.17.2 // indirect
22+
github.com/distribution/reference v0.6.0 // indirect
23+
github.com/docker/docker v27.1.1+incompatible // indirect
24+
github.com/docker/go-connections v0.5.0 // indirect
25+
github.com/docker/go-units v0.5.0 // indirect
26+
github.com/felixge/httpsnoop v1.0.4 // indirect
27+
github.com/go-logr/logr v1.4.1 // indirect
28+
github.com/go-logr/stdr v1.2.2 // indirect
29+
github.com/go-ole/go-ole v1.2.6 // indirect
30+
github.com/gogo/protobuf v1.3.2 // indirect
31+
github.com/google/uuid v1.6.0 // indirect
32+
github.com/klauspost/compress v1.17.4 // indirect
33+
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
34+
github.com/magiconair/properties v1.8.7 // indirect
35+
github.com/moby/docker-image-spec v1.3.1 // indirect
36+
github.com/moby/patternmatcher v0.6.0 // indirect
37+
github.com/moby/sys/sequential v0.5.0 // indirect
38+
github.com/moby/sys/user v0.1.0 // indirect
39+
github.com/moby/term v0.5.0 // indirect
40+
github.com/morikuni/aec v1.0.0 // indirect
1341
github.com/nats-io/nkeys v0.4.7 // indirect
1442
github.com/nats-io/nuid v1.0.1 // indirect
43+
github.com/opencontainers/go-digest v1.0.0 // indirect
44+
github.com/opencontainers/image-spec v1.1.0 // indirect
45+
github.com/pkg/errors v0.9.1 // indirect
1546
github.com/pmezard/go-difflib v1.0.0 // indirect
16-
golang.org/x/crypto v0.18.0 // indirect
17-
golang.org/x/sys v0.16.0 // indirect
18-
golang.org/x/text v0.14.0 // indirect
47+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
48+
github.com/shirou/gopsutil/v3 v3.23.12 // indirect
49+
github.com/shoenig/go-m1cpu v0.1.6 // indirect
50+
github.com/sirupsen/logrus v1.9.3 // indirect
51+
github.com/tklauser/go-sysconf v0.3.12 // indirect
52+
github.com/tklauser/numcpus v0.6.1 // indirect
53+
github.com/yusufpapurcu/wmi v1.2.3 // indirect
54+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
55+
go.opentelemetry.io/otel v1.24.0 // indirect
56+
go.opentelemetry.io/otel/metric v1.24.0 // indirect
57+
go.opentelemetry.io/otel/trace v1.24.0 // indirect
58+
golang.org/x/crypto v0.31.0 // indirect
59+
golang.org/x/sys v0.28.0 // indirect
60+
golang.org/x/text v0.21.0 // indirect
1961
gopkg.in/yaml.v3 v3.0.1 // indirect
2062
)

0 commit comments

Comments
 (0)