Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adopt testcontainers-go for Postgres, MySQL, MSSQL and MongoDB #1515

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4ed3649
chore: use testcontainers-go in mongodb store
mdelapenya Aug 29, 2024
0e060e1
chore: use testcontainers-go in mssql store
mdelapenya Aug 29, 2024
2f17493
chore: use testcontainers-go in mysql store
mdelapenya Aug 29, 2024
2f5263e
chore: use testcontainers-go in postgres store
mdelapenya Aug 29, 2024
689759c
fix: wrong image name for mongo
mdelapenya Aug 29, 2024
ff25433
fix: proper Go version matrix
mdelapenya Aug 29, 2024
fc01fc5
fix: remove toolchain in go mod
mdelapenya Aug 29, 2024
4ad4b03
chor: consistent Go version
mdelapenya Aug 29, 2024
b53f02b
fix: remove toolchain
mdelapenya Aug 29, 2024
de8f798
chore: consistent Go versions matrix
mdelapenya Aug 29, 2024
471a6ac
fix: remove more postgres options
mdelapenya Sep 16, 2024
c80f126
chore: adjust Go matrix versions to use 1.20 as the minimum version
mdelapenya Sep 16, 2024
1d6c0c3
chore: set Go 1.21 for modules
mdelapenya Sep 16, 2024
4d7a172
chore: use Ubuntu 22.04 base image for MSSQL
mdelapenya Sep 18, 2024
75c8525
chore: close store for previous modules
mdelapenya Sep 18, 2024
1bb4d92
chore: close store
mdelapenya Sep 18, 2024
f962d64
chore: terminate container on end
mdelapenya Sep 18, 2024
1c23d53
chore: bump MSSQL image to not crash in the GH workers
mdelapenya Sep 19, 2024
7bbad9a
fix: swap values in mysql constants
mdelapenya Sep 19, 2024
efbc89f
fix: do not close store twice in tests
mdelapenya Sep 19, 2024
153c837
fix: reorder
mdelapenya Sep 19, 2024
43a47ef
fix: do not close twice in mysql test
mdelapenya Sep 19, 2024
3cd89db
fix: terminate second mysql container
mdelapenya Sep 19, 2024
60be628
chore: bump couchbase image
mdelapenya Sep 19, 2024
a4849c8
Revert "fix: terminate second mysql container"
mdelapenya Sep 19, 2024
b3a2e40
chore: bump testcontainers-go to v0.34.0
mdelapenya Oct 23, 2024
db3ab9a
Merge branch 'main' into tc-go-adoption-2
mdelapenya Dec 11, 2024
78da7fc
chore(ci): run modules in Go 1.21 and above
mdelapenya Dec 11, 2024
49eeb1d
chore: add verbose flag to benchmarks
mdelapenya Dec 11, 2024
1a5e6f9
chore: include Go 1.23 for clickhouse tests
mdelapenya Dec 11, 2024
cdf78c2
chore: tune the benchmark worker
mdelapenya Dec 11, 2024
a7a26b8
fix: run with sudo
mdelapenya Dec 11, 2024
39be258
chore: remove tuning
mdelapenya Dec 11, 2024
8ee8130
chore: bump MSSQL image
mdelapenya Dec 11, 2024
bff5333
chore: simplify testing panics
mdelapenya Dec 12, 2024
8cb7bc5
chore: increase sysctl values for the MSSQL container
mdelapenya Dec 12, 2024
15865d5
Revert "chore: increase sysctl values for the MSSQL container"
mdelapenya Dec 12, 2024
4f1577a
fix: use ubuntu-22.04 as GH runner for the benchmarks
mdelapenya Dec 12, 2024
478ea67
Revert "fix: use ubuntu-22.04 as GH runner for the benchmarks"
mdelapenya Dec 12, 2024
b074e83
chore: try MSSQL 2022 latest image
mdelapenya Dec 12, 2024
cac4fd5
chore: use cleanup function
mdelapenya Dec 12, 2024
ae3a2de
chore: revert MSSQL work
mdelapenya Dec 12, 2024
c061165
chor: increase go test timeout
mdelapenya Dec 12, 2024
af52fa3
chore: define timeout for the workflow
mdelapenya Dec 12, 2024
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
53 changes: 4 additions & 49 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,46 +34,6 @@ jobs:
image: 'memcached:latest'
ports:
- '11211:11211'
mongo:
image: 'mongo:latest'
ports:
- '27017:27017'
mssql:
image: 'mcmoe/mssqldocker:latest'
ports:
- '1433:1433'
env:
ACCEPT_EULA: Y
SA_PASSWORD: MsSql!1234
MSSQL_DB: master
MSSQL_USER: sa
MSSQL_PASSWORD: MsSql!1234
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -U sa -P $SA_PASSWORD -Q 'select 1' -b -o /dev/null"
--health-interval 1s
--health-timeout 30s
--health-start-period 10s
--health-retries 20
mysql:
image: 'mysql:latest'
env:
MYSQL_DATABASE: fiber
MYSQL_USER: username
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
ports:
- '3306:3306'
options: >-
--health-cmd "mysqladmin ping" --health-interval 10s --health-timeout
5s --health-retries 5
postgres:
image: 'postgres:latest'
ports:
- '5432:5432'
env:
POSTGRES_DB: fiber
POSTGRES_USER: username
POSTGRES_PASSWORD: "pass#w%rd"
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
Expand Down Expand Up @@ -152,18 +112,13 @@ jobs:
done
shell: bash
env:
MSSQL_DATABASE: master
MSSQL_USERNAME: sa
MSSQL_PASSWORD: MsSql!1234
MYSQL_USERNAME: username
MYSQL_PASSWORD: password
MYSQL_DATABASE: fiber
POSTGRES_DATABASE: fiber
POSTGRES_USERNAME: username
POSTGRES_PASSWORD: "pass#w%rd"
TEST_CLICKHOUSE_IMAGE: "clickhouse/clickhouse-server:23-alpine"
TEST_COUCHBASE_IMAGE: "couchbase:enterprise-7.1.1"
TEST_MINIO_IMAGE: "docker.io/minio/minio:RELEASE.2024-08-17T01-24-54Z"
TEST_MONGODB_IMAGE: "docker.io/mongo:7"
TEST_MSSQL_IMAGE: "mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04"
TEST_MYSQL_IMAGE: "docker.io/mysql:9"
TEST_POSTGRES_IMAGE: "docker.io/postgres:16-alpine"

- name: Get Previous Benchmark Results
uses: actions/cache@v4
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/test-mongodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@ name: "Tests Mongodb"
jobs:
Tests:
runs-on: ubuntu-latest
services:
mongo:
image: 'mongo:latest'
ports:
- '27017:27017'
strategy:
matrix:
go-version:
- 1.19.x
- 1.20.x
- 1.21.x
- 1.22.x
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
- 1.23.x
steps:
- name: Fetch Repository
uses: actions/checkout@v4
Expand All @@ -31,5 +26,7 @@ jobs:
with:
go-version: '${{ matrix.go-version }}'
- name: Run Test
env:
TEST_MONGODB_IMAGE: docker.io/mongo:7
run: cd ./mongodb && go test ./... -v -race

23 changes: 2 additions & 21 deletions .github/workflows/test-mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@ name: "Tests MSSQL"
jobs:
Tests:
runs-on: ubuntu-latest
services:
mssql:
image: 'mcmoe/mssqldocker:latest'
ports:
- '1433:1433'
env:
ACCEPT_EULA: Y
SA_PASSWORD: MsSql!1234
MSSQL_DB: master
MSSQL_USER: sa
MSSQL_PASSWORD: MsSql!1234
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -U sa -P $SA_PASSWORD -Q 'select 1' -b -o /dev/null"
--health-interval 1s
--health-timeout 30s
--health-start-period 10s
--health-retries 20
strategy:
matrix:
go-version:
Expand All @@ -43,8 +26,6 @@ jobs:
with:
go-version: '${{ matrix.go-version }}'
- name: Run Test
run: cd ./mssql && go test ./... -v -race
env:
MSSQL_DATABASE: master
MSSQL_USERNAME: sa
MSSQL_PASSWORD: MsSql!1234
TEST_MSSQL_IMAGE: "mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04"
run: cd ./mssql && go test ./... -v -race
19 changes: 2 additions & 17 deletions .github/workflows/test-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ name: "Tests MySQL"
jobs:
Tests:
runs-on: ubuntu-latest
services:
mysql:
image: 'mysql:latest'
env:
MYSQL_DATABASE: fiber
MYSQL_USER: username
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
ports:
- '3306:3306'
options: >-
--health-cmd "mysqladmin ping" --health-interval 10s --health-timeout
5s --health-retries 5
strategy:
matrix:
go-version:
Expand All @@ -39,8 +26,6 @@ jobs:
with:
go-version: '${{ matrix.go-version }}'
- name: Run Test
run: cd ./mysql && go test ./... -v -race
env:
MYSQL_USERNAME: username
MYSQL_PASSWORD: password
MYSQL_DATABASE: fiber
TEST_MYSQL_IMAGE: docker.io/mysql:9
run: cd ./mysql && go test ./... -v -race
18 changes: 2 additions & 16 deletions .github/workflows/test-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ name: "Tests Postgres"
jobs:
Tests:
runs-on: ubuntu-latest
services:
postgres:
image: 'postgres:latest'
ports:
- '5432:5432'
env:
POSTGRES_DB: fiber
POSTGRES_USER: username
POSTGRES_PASSWORD: "pass#w%rd"
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
strategy:
matrix:
go-version:
Expand All @@ -38,8 +26,6 @@ jobs:
with:
go-version: '${{ matrix.go-version }}'
- name: Run Test
run: cd ./postgres && go test ./... -v -race
env:
POSTGRES_DATABASE: fiber
POSTGRES_USERNAME: username
POSTGRES_PASSWORD: "pass#w%rd"
TEST_POSTGRES_IMAGE: "docker.io/postgres:16-alpine"
run: cd ./postgres && go test ./... -v -race
54 changes: 50 additions & 4 deletions mongodb/go.mod
Original file line number Diff line number Diff line change
@@ -1,24 +1,70 @@
module github.com/gofiber/storage/mongodb/v2

go 1.19
go 1.21

toolchain go1.22.1
gaby marked this conversation as resolved.
Show resolved Hide resolved

require (
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go/modules/mongodb v0.33.0
go.mongodb.org/mongo-driver v1.16.1
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/containerd/containerd v1.7.18 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v27.1.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/montanaflynn/stats v0.7.1 // 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.0 // 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/v3 v3.23.12 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/testcontainers/testcontainers-go v0.33.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
golang.org/x/crypto v0.22.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading