Skip to content

Commit f19bcd6

Browse files
authored
Merge pull request #1723 from mdelapenya/fix-ruedis-benchmarks
feat(redis): use testcontainers in rueidis and valkey
2 parents 40b2566 + bf7c309 commit f19bcd6

20 files changed

Lines changed: 1503 additions & 376 deletions

.github/scripts/gen-test-certs.sh

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/benchmark.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Generate filters
2929
id: filter-setup
3030
run: |
31-
filters=$(find . -maxdepth 1 -type d ! -path ./.git ! -path . -exec basename {} \; | grep -v '^\.' | awk '{printf "%s: \"%s/**\"\n", $1, $1}')
31+
filters=$(find . -maxdepth 1 -type d ! -path ./.git ! -path . ! -path ./testhelpers -exec basename {} \; | grep -v '^\.' | awk '{printf "%s: \"%s/**\"\n", $1, $1}')
3232
echo "filters<<EOF" >> $GITHUB_OUTPUT
3333
echo "$filters" >> $GITHUB_OUTPUT
3434
echo "EOF" >> $GITHUB_OUTPUT
@@ -111,6 +111,7 @@ jobs:
111111
TEST_REDIS_IMAGE: "docker.io/redis:7"
112112
TEST_SCYLLADB_IMAGE: "scylladb/scylla:6.2"
113113
TEST_SURREALDB_IMAGE: "surrealdb/surrealdb:latest"
114+
TEST_VALKEY_IMAGE: "valkey/valkey:8"
114115
COHERENCE_LOG_LEVEL: "ERROR"
115116

116117
- name: Get Previous Benchmark Results

.github/workflows/golangci-lint.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ jobs:
3131
- name: Generate filters
3232
id: filter-setup
3333
run: |
34-
filters=$(find . -maxdepth 1 -type d ! -path ./.git ! -path . -exec basename {} \; | grep -v '^\.' | awk '{printf "%s: \"%s/**\"\n", $1, $1}')
34+
filters=$(find . -maxdepth 1 -type d ! -path ./.git ! -path . ! -path ./testhelpers -exec basename {} \; | grep -v '^\.' | awk '{printf "%s: \"%s/**\"\n", $1, $1}')
35+
# Add all testhelpers subdirectories to filters
36+
testhelpers_filters=$(find ./testhelpers -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | awk '{printf "testhelpers/%s: \"testhelpers/%s/**\"\n", $1, $1}')
3537
echo "filters<<EOF" >> $GITHUB_OUTPUT
3638
echo "$filters" >> $GITHUB_OUTPUT
39+
echo "$testhelpers_filters" >> $GITHUB_OUTPUT
3740
echo "EOF" >> $GITHUB_OUTPUT
3841
shell: bash
3942

.github/workflows/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Generate filters
1919
id: filter-setup
2020
run: |
21-
filters=$(find . -maxdepth 1 -type d ! -path ./.git ! -path . -exec basename {} \; | grep -v '^\.' | awk '{printf "%s: \"%s/**\"\n", $1, $1}')
21+
filters=$(find . -maxdepth 1 -type d ! -path ./.git ! -path . ! -path ./testhelpers -exec basename {} \; | grep -v '^\.' | awk '{printf "%s: \"%s/**\"\n", $1, $1}')
2222
echo "filters<<EOF" >> $GITHUB_OUTPUT
2323
echo "$filters" >> $GITHUB_OUTPUT
2424
echo "EOF" >> $GITHUB_OUTPUT

.github/workflows/test-rueidis.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,15 @@ jobs:
1515
strategy:
1616
matrix:
1717
go-version:
18-
- 1.20.x
19-
- 1.21.x
18+
- 1.23.x
19+
- 1.24.x
2020
redis:
21-
- '6.x'
22-
- '7.x'
21+
- '6'
22+
- '7'
2323
steps:
2424
- name: Fetch Repository
2525
uses: actions/checkout@v4
2626

27-
- name: Generate TLS certs
28-
run: ./.github/scripts/gen-test-certs.sh
29-
30-
- name: Setup Redis
31-
uses: shogo82148/actions-setup-redis@v1
32-
with:
33-
redis-version: ${{ matrix.redis }}
34-
auto-start: 'false'
35-
redis-port: '6379'
36-
redis-tls-port: '6380'
37-
38-
- name: Run Redis
39-
run: |
40-
redis-server --tls-port 6380 --port 6379 \
41-
--tls-cert-file /home/runner/work/storage/storage/tls/redis.crt \
42-
--tls-key-file /home/runner/work/storage/storage/tls/redis.key \
43-
--tls-ca-cert-file /home/runner/work/storage/storage/tls/ca.crt &
44-
4527
- name: Setup Redis Cluster
4628
uses: vishnudxb/redis-cluster@1.0.9
4729
with:
@@ -59,4 +41,6 @@ jobs:
5941
go-version: '${{ matrix.go-version }}'
6042

6143
- name: Run Test
44+
env:
45+
TEST_REDIS_IMAGE: "docker.io/redis:${{ matrix.redis }}"
6246
run: cd ./rueidis && go test ./... -v -race
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- main
6+
paths:
7+
- 'testhelpers/redis/**'
8+
pull_request:
9+
paths:
10+
- 'testhelpers/redis/**'
11+
name: "Tests TestHelper Redis"
12+
jobs:
13+
Tests:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
go-version:
18+
- 1.23.x
19+
- 1.24.x
20+
redis:
21+
- '6'
22+
- '7'
23+
steps:
24+
- name: Fetch Repository
25+
uses: actions/checkout@v4
26+
27+
- name: Install Go
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version: '${{ matrix.go-version }}'
31+
32+
- name: Run Test
33+
env:
34+
TEST_REDIS_IMAGE: "docker.io/redis:${{ matrix.redis }}"
35+
working-directory: testhelpers/redis
36+
run: go test ./... -v -race

.github/workflows/test-valkey.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,14 @@ jobs:
1717
matrix:
1818
go-version:
1919
- 1.23.x
20+
- 1.24.x
2021
valkey:
21-
- '7.x'
22-
- '8.x'
22+
- '7'
23+
- '8'
2324
steps:
2425
- name: Fetch Repository
2526
uses: actions/checkout@v4
2627

27-
- name: Generate TLS certs
28-
run: ./.github/scripts/gen-test-certs.sh
29-
30-
- name: Setup Valkey
31-
uses: shogo82148/actions-setup-redis@v1
32-
with:
33-
distribution: 'valkey'
34-
redis-version: ${{ matrix.valkey }}
35-
auto-start: 'false'
36-
redis-port: '6379'
37-
redis-tls-port: '6380'
38-
39-
- name: Run Valkey
40-
run: |
41-
valkey-server --tls-port 6380 --port 6379 \
42-
--tls-cert-file /home/runner/work/storage/storage/tls/valkey.crt \
43-
--tls-key-file /home/runner/work/storage/storage/tls/valkey.key \
44-
--tls-ca-cert-file /home/runner/work/storage/storage/tls/ca.crt &
45-
4628
- name: Setup Valkey Cluster
4729
uses: vishnudxb/redis-cluster@1.0.9
4830
with:
@@ -60,4 +42,6 @@ jobs:
6042
go-version: '${{ matrix.go-version }}'
6143

6244
- name: Run Test
45+
env:
46+
TEST_VALKEY_IMAGE: "valkey/valkey:${{ matrix.valkey }}"
6347
run: cd ./valkey && go test ./... -v -race

redis/go.mod

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ module github.com/gofiber/storage/redis/v3
33
go 1.23.0
44

55
require (
6+
github.com/gofiber/storage/testhelpers/redis v0.0.0-00010101000000-000000000000
67
github.com/redis/go-redis/v9 v9.8.0
78
github.com/stretchr/testify v1.10.0
8-
github.com/testcontainers/testcontainers-go v0.37.0
9-
github.com/testcontainers/testcontainers-go/modules/redis v0.37.0
109
)
1110

11+
replace github.com/gofiber/storage/testhelpers/redis => ../testhelpers/redis
12+
1213
require (
1314
dario.cat/mergo v1.0.1 // indirect
1415
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
@@ -49,6 +50,8 @@ require (
4950
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
5051
github.com/shirou/gopsutil/v4 v4.25.1 // indirect
5152
github.com/sirupsen/logrus v1.9.3 // indirect
53+
github.com/testcontainers/testcontainers-go v0.37.0 // indirect
54+
github.com/testcontainers/testcontainers-go/modules/redis v0.37.0 // indirect
5255
github.com/tklauser/go-sysconf v0.3.12 // indirect
5356
github.com/tklauser/numcpus v0.6.1 // indirect
5457
github.com/yusufpapurcu/wmi v1.2.4 // indirect
@@ -62,6 +65,7 @@ require (
6265
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
6366
golang.org/x/crypto v0.37.0 // indirect
6467
golang.org/x/sys v0.32.0 // indirect
68+
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
6569
google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e // indirect
6670
google.golang.org/protobuf v1.36.6 // indirect
6771
gopkg.in/yaml.v3 v3.0.1 // indirect

redis/go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
5353
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
5454
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
5555
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
56-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg=
57-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1/go.mod h1:RBRO7fro65R6tjKzYgLAFo0t1QEXY1Dp+i/bvpRiqiQ=
56+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
57+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
5858
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
5959
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
6060
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
@@ -180,12 +180,12 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
180180
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
181181
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
182182
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
183-
google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d h1:H8tOf8XM88HvKqLTxe755haY6r1fqqzLbEnfrmLXlSA=
184-
google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d/go.mod h1:2v7Z7gP2ZUOGsaFyxATQSRoBnKygqVq2Cwnvom7QiqY=
183+
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
184+
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
185185
google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e h1:ztQaXfzEXTmCBvbtWYRhJxW+0iJcz2qXfd38/e9l7bA=
186186
google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
187-
google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU=
188-
google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
187+
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
188+
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
189189
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
190190
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
191191
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

0 commit comments

Comments
 (0)