Skip to content
Merged
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@ name: CI

on: [push]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 25

strategy:
fail-fast: false
matrix:
go: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24"]
go: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25", "1.26", "1.27"]
stage: [testredis, testconn, testcluster]
exclude:
# Cluster suite spawns a 7-node redis cluster and takes ~7 minutes per
# matrix cell, while its behaviour does not depend on the go version.
- {go: "1.20", stage: testcluster}
- {go: "1.21", stage: testcluster}
- {go: "1.22", stage: testcluster}
- {go: "1.23", stage: testcluster}
- {go: "1.24", stage: testcluster}
- {go: "1.25", stage: testcluster}
- {go: "1.26", stage: testcluster}

steps:

Expand Down Expand Up @@ -43,4 +59,3 @@ jobs:

- name: Build
run: make ${{ matrix.stage }}

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test: testcluster testconn testredis
rm redis-$(REDIS_VERSION) -rf

testredis: /tmp/redis-server/redis-server
PATH=/tmp/redis-server/:${PATH} go test ./redis
PATH=/tmp/redis-server/:${PATH} go test -count 1 ./redis

testconn: /tmp/redis-server/redis-server
killall redis-server || true
Expand Down
10 changes: 5 additions & 5 deletions redis/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func ExampleAsError() {
}

func ExampleScanner() {
defer runServer(46231)()
defer runServer(21050)()
ctx := context.Background()
conn, _ := redisconn.Connect(ctx, "127.0.0.1:46231", redisconn.Opts{
conn, _ := redisconn.Connect(ctx, "127.0.0.1:21050", redisconn.Opts{
Logger: redisconn.NoopLogger{},
})
sync := redis.Sync{conn}
Expand All @@ -79,9 +79,9 @@ func ExampleScanner() {
}

func ExampleSync() {
defer runServer(46231)()
defer runServer(21050)()
ctx := context.Background()
conn, _ := redisconn.Connect(ctx, "127.0.0.1:46231", redisconn.Opts{
conn, _ := redisconn.Connect(ctx, "127.0.0.1:21050", redisconn.Opts{
Logger: redisconn.NoopLogger{},
})
sync := redis.Sync{conn}
Expand Down Expand Up @@ -114,7 +114,7 @@ func ExampleSync() {
// OK
// OK
// ["1" "2"]
// redispipe.result: WRONGTYPE Operation against a key holding the wrong kind of value {request: Req("HSET", ["key1" "field1" "val1"]), address: 127.0.0.1:46231}
// redispipe.result: WRONGTYPE Operation against a key holding the wrong kind of value {request: Req("HSET", ["key1" "field1" "val1"]), address: 127.0.0.1:21050}
// <nil>
// ['\x02' '\x01' "2" "1"]
}
Expand Down
16 changes: 8 additions & 8 deletions rediscluster/bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func benchCluster(port int) func() {
}

func BenchmarkSerialGetSet(b *B) {
defer benchCluster(45000)()
defer benchCluster(21080)()
rng := rand.New(rand.NewSource(1))
b.Run("radix_pause0", func(b *B) {
rdxv2, err := radix.NewCluster(
[]string{"127.0.0.1:45000"},
[]string{"127.0.0.1:21080"},
radix.ClusterPoolFunc(func(network, addr string) (radix.Client, error) {
return radix.NewPool(network, addr, 4,
radix.PoolPipelineWindow(0, 0))
Expand Down Expand Up @@ -72,7 +72,7 @@ func BenchmarkSerialGetSet(b *B) {
})

b.Run("redispipe", func(b *B) {
pipe, err := rediscluster.NewCluster(context.Background(), []string{"127.0.0.1:45000"}, rediscluster.Opts{
pipe, err := rediscluster.NewCluster(context.Background(), []string{"127.0.0.1:21080"}, rediscluster.Opts{
Logger: rediscluster.NoopLogger{},
HostOpts: redisconn.Opts{
Logger: redisconn.NoopLogger{},
Expand All @@ -96,7 +96,7 @@ func BenchmarkSerialGetSet(b *B) {
})

b.Run("redispipe_pause0", func(b *B) {
pipe, err := rediscluster.NewCluster(context.Background(), []string{"127.0.0.1:45000"}, rediscluster.Opts{
pipe, err := rediscluster.NewCluster(context.Background(), []string{"127.0.0.1:21080"}, rediscluster.Opts{
Logger: rediscluster.NoopLogger{},
HostOpts: redisconn.Opts{
Logger: redisconn.NoopLogger{},
Expand All @@ -122,7 +122,7 @@ func BenchmarkSerialGetSet(b *B) {
}

func BenchmarkParallelGetSet(b *B) {
defer benchCluster(45000)()
defer benchCluster(21080)()
parallel := runtime.GOMAXPROCS(0) * 8
i := uint32(1)

Expand All @@ -137,7 +137,7 @@ func BenchmarkParallelGetSet(b *B) {
}

b.Run("radix", func(b *B) {
rdx2, err := radix.NewCluster([]string{"127.0.0.1:45000"})
rdx2, err := radix.NewCluster([]string{"127.0.0.1:21080"})
defer rdx2.Close()
if err != nil {
b.Fatal(err)
Expand Down Expand Up @@ -170,7 +170,7 @@ func BenchmarkParallelGetSet(b *B) {
})

b.Run("redispipe", func(b *B) {
pipe, err := rediscluster.NewCluster(context.Background(), []string{"127.0.0.1:45000"}, rediscluster.Opts{
pipe, err := rediscluster.NewCluster(context.Background(), []string{"127.0.0.1:21080"}, rediscluster.Opts{
Logger: rediscluster.NoopLogger{},
HostOpts: redisconn.Opts{
Logger: redisconn.NoopLogger{},
Expand All @@ -196,7 +196,7 @@ func BenchmarkParallelGetSet(b *B) {

func newRedigo() *redigo.Cluster {
c, err := redigo.NewCluster(&redigo.Options{
StartNodes: []string{"127.0.0.1:45000"},
StartNodes: []string{"127.0.0.1:21080"},
ConnTimeout: time.Minute,
KeepAlive: 128,
AliveTime: time.Minute,
Expand Down
Loading
Loading