Skip to content

Commit f30074b

Browse files
committed
wip
1 parent bdb19f5 commit f30074b

File tree

12 files changed

+55
-56
lines changed

12 files changed

+55
-56
lines changed

.github/actions/run-tests/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ runs:
2222
run: |
2323
set -e
2424
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
25+
redis_version_np=$(echo "$REDIS_VERSION" | grep -oP '^\d+.\d+')
2526
if (( redis_major_version < 8 )); then
2627
echo "Using redis-stack for module tests"
2728
else
@@ -36,7 +37,7 @@ runs:
3637
)
3738
3839
if [[ -v redis_version_mapping[$REDIS_VERSION] ]]; then
39-
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
40+
echo "REDIS_VERSION=${redis_version_np}" >> $GITHUB_ENV
4041
echo "REDIS_IMAGE=redis:${{ inputs.redis-version }}" >> $GITHUB_ENV
4142
echo "CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:${redis_version_mapping[$REDIS_VERSION]}" >> $GITHUB_ENV
4243
else
@@ -58,5 +59,4 @@ runs:
5859
--ginkgo.skip-file="sentinel_test.go" \
5960
--ginkgo.skip-file="pubsub_test.go" \
6061
--ginkgo.skip-file="gears_commands_test.go" \
61-
--ginkgo.label-filter="!NonRedisEnterprise"
6262
shell: bash

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
go-version: [1.21.x, 1.22.x, 1.23.x]
19+
go-version: [1.22.x, 1.23.x]
2020

2121
steps:
2222
- name: Set up ${{ matrix.go-version }}
@@ -42,7 +42,7 @@ jobs:
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
go-version: [1.21.x, 1.23.x]
45+
go-version: [1.22.x, 1.23.x]
4646

4747
steps:
4848
- name: Set up ${{ matrix.go-version }}

.github/workflows/doctests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
go-version: [ "1.21", "1.22", "1.23" ]
28+
go-version: ["1.22", "1.23"]
2929

3030
steps:
3131
- name: Set up ${{ matrix.go-version }}
@@ -38,4 +38,4 @@ jobs:
3838

3939
- name: Test doc examples
4040
working-directory: ./doctests
41-
run: go test
41+
run: go test -v

.github/workflows/test-redis-enterprise.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Test
4848
env:
4949
RE_CLUSTER: true
50-
REDIS_MAJOR_VERSION: 7
50+
REDIS_VERSION: "7.4"
5151
run: |
5252
go test \
5353
--ginkgo.skip-file="ring_test.go" \

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
2-
export REDIS_MAJOR_VERSION := 7
2+
export REDIS_VERSION := "7.2"
33

44
redisstackdocker.start:
55
docker start go-redis-redis-stack || docker run -d --name go-redis-redis-stack -p 6379:6379 -e REDIS_ARGS="--enable-debug-command yes --enable-module-command yes" redis/redis-stack-server:latest

acl_commands_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ var _ = Describe("ACL permissions", Label("NonRedisEnterprise"), func() {
242242
})
243243

244244
It("set permissions for module commands", func() {
245-
SkipBeforeRedisMajor(8, "permissions for modules are supported for Redis Version >=8")
245+
SkipBeforeRedisVersion(8, "permissions for modules are supported for Redis Version >=8")
246246
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
247247
val, err := client.FTCreate(ctx, "txt", &redis.FTCreateOptions{}, &redis.FieldSchema{FieldName: "txt", FieldType: redis.SearchFieldTypeText}).Result()
248248
Expect(err).NotTo(HaveOccurred())
@@ -322,7 +322,7 @@ var _ = Describe("ACL permissions", Label("NonRedisEnterprise"), func() {
322322
})
323323

324324
It("set permissions for module categories", func() {
325-
SkipBeforeRedisMajor(8, "permissions for modules are supported for Redis Version >=8")
325+
SkipBeforeRedisVersion(8, "permissions for modules are supported for Redis Version >=8")
326326
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
327327
val, err := client.FTCreate(ctx, "txt", &redis.FTCreateOptions{}, &redis.FieldSchema{FieldName: "txt", FieldType: redis.SearchFieldTypeText}).Result()
328328
Expect(err).NotTo(HaveOccurred())
@@ -419,7 +419,7 @@ var _ = Describe("ACL Categories", func() {
419419
})
420420

421421
It("lists acl categories and subcategories with Modules", func() {
422-
SkipBeforeRedisMajor(8, "modules are included in acl for redis version >= 8")
422+
SkipBeforeRedisVersion(8, "modules are included in acl for redis version >= 8")
423423
aclTestCase := map[string]string{
424424
"search": "FT.CREATE",
425425
"bloom": "bf.add",

commands_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ var _ = Describe("Commands", func() {
345345
})
346346

347347
It("should ConfigGet Modules", func() {
348-
SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8")
348+
SkipBeforeRedisVersion(8, "Config doesn't include modules before Redis 8")
349349
expected := map[string]string{
350350
"search-*": "search-timeout",
351351
"ts-*": "ts-retention-policy",
@@ -380,7 +380,7 @@ var _ = Describe("Commands", func() {
380380
})
381381

382382
It("should ConfigGet with Modules", Label("NonRedisEnterprise"), func() {
383-
SkipBeforeRedisMajor(8, "config get won't return modules configs before redis 8")
383+
SkipBeforeRedisVersion(8, "config get won't return modules configs before redis 8")
384384
configGet := client.ConfigGet(ctx, "*")
385385
Expect(configGet.Err()).NotTo(HaveOccurred())
386386
Expect(configGet.Val()).To(HaveKey("maxmemory"))
@@ -391,7 +391,7 @@ var _ = Describe("Commands", func() {
391391
})
392392

393393
It("should ConfigSet FT DIALECT", func() {
394-
SkipBeforeRedisMajor(8, "config doesn't include modules before Redis 8")
394+
SkipBeforeRedisVersion(8, "config doesn't include modules before Redis 8")
395395
defaultState, err := client.ConfigGet(ctx, "search-default-dialect").Result()
396396
Expect(err).NotTo(HaveOccurred())
397397

@@ -437,13 +437,13 @@ var _ = Describe("Commands", func() {
437437
})
438438

439439
It("should ConfigSet fail for ReadOnly", func() {
440-
SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8")
440+
SkipBeforeRedisVersion(8, "Config doesn't include modules before Redis 8")
441441
_, err := client.ConfigSet(ctx, "search-max-doctablesize", "100000").Result()
442442
Expect(err).To(HaveOccurred())
443443
})
444444

445445
It("should ConfigSet Modules", func() {
446-
SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8")
446+
SkipBeforeRedisVersion(8, "Config doesn't include modules before Redis 8")
447447
defaults := map[string]string{}
448448
expected := map[string]string{
449449
"search-timeout": "100",
@@ -484,7 +484,7 @@ var _ = Describe("Commands", func() {
484484
})
485485

486486
It("should Fail ConfigSet Modules", func() {
487-
SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8")
487+
SkipBeforeRedisVersion(8, "Config doesn't include modules before Redis 8")
488488
expected := map[string]string{
489489
"search-timeout": "-100",
490490
"ts-retention-policy": "-10",
@@ -533,7 +533,7 @@ var _ = Describe("Commands", func() {
533533
})
534534

535535
It("should Info Modules", Label("redis.info"), func() {
536-
SkipBeforeRedisMajor(8, "modules are included in info for Redis Version >= 8")
536+
SkipBeforeRedisVersion(8, "modules are included in info for Redis Version >= 8")
537537
info := client.Info(ctx)
538538
Expect(info.Err()).NotTo(HaveOccurred())
539539
Expect(info.Val()).NotTo(BeNil())
@@ -558,7 +558,7 @@ var _ = Describe("Commands", func() {
558558
})
559559

560560
It("should InfoMap Modules", Label("redis.info"), func() {
561-
SkipBeforeRedisMajor(8, "modules are included in info for Redis Version >= 8")
561+
SkipBeforeRedisVersion(8, "modules are included in info for Redis Version >= 8")
562562
info := client.InfoMap(ctx)
563563
Expect(info.Err()).NotTo(HaveOccurred())
564564
Expect(info.Val()).NotTo(BeNil())

main_test.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,20 @@ var RECluster = false
7070
// Redis Community Edition Docker
7171
var RCEDocker = false
7272

73-
// Notes the major version of redis we are executing tests.
73+
// Notes version of redis we are executing tests against.
7474
// This can be used before we change the bsm fork of ginkgo for one,
75-
// which have support for label sets, so we can filter tests per redis major version.
76-
var RedisMajorVersion = 7
75+
// which have support for label sets, so we can filter tests per redis version.
76+
var RedisVersion float64 = 7.2
7777

78-
func SkipBeforeRedisMajor(version int, msg string) {
79-
if RedisMajorVersion < version {
80-
Skip(fmt.Sprintf("(redis major version < %d) %s", version, msg))
78+
func SkipBeforeRedisVersion(version float64, msg string) {
79+
if RedisVersion < version {
80+
Skip(fmt.Sprintf("(redis version < %f) %s", version, msg))
8181
}
8282
}
8383

84-
func SkipAfterRedisMajor(version int, msg string) {
85-
if RedisMajorVersion > version {
86-
Skip(fmt.Sprintf("(redis major version > %d) %s", version, msg))
84+
func SkipAfterRedisVersion(version float64, msg string) {
85+
if RedisVersion > version {
86+
Skip(fmt.Sprintf("(redis version > %f) %s", version, msg))
8787
}
8888
}
8989

@@ -104,18 +104,18 @@ var _ = BeforeSuite(func() {
104104
RECluster, _ = strconv.ParseBool(os.Getenv("RE_CLUSTER"))
105105
RCEDocker, _ = strconv.ParseBool(os.Getenv("RCE_DOCKER"))
106106

107-
RedisMajorVersion, _ = strconv.Atoi(os.Getenv("REDIS_MAJOR_VERSION"))
107+
RedisVersion, _ = strconv.ParseFloat(os.Getenv("REDIS_VERSION"), 64)
108108

109-
if RedisMajorVersion == 0 {
110-
RedisMajorVersion = 7
109+
if RedisVersion == 0 {
110+
RedisVersion = 7.2
111111
}
112112

113113
fmt.Printf("RECluster: %v\n", RECluster)
114114
fmt.Printf("RCEDocker: %v\n", RCEDocker)
115-
fmt.Printf("REDIS_MAJOR_VERSION: %v\n", RedisMajorVersion)
115+
fmt.Printf("REDIS_VERSION: %v\n", RedisVersion)
116116

117-
if RedisMajorVersion < 6 || RedisMajorVersion > 8 {
118-
panic("incorrect or not supported redis major version")
117+
if RedisVersion < 7.0 || RedisVersion > 9 {
118+
panic("incorrect or not supported redis version")
119119
}
120120

121121
if !RECluster && !RCEDocker {
@@ -204,7 +204,7 @@ func redisOptions() *redis.Options {
204204
}
205205
return &redis.Options{
206206
Addr: redisAddr,
207-
DB: 15,
207+
DB: 0,
208208

209209
DialTimeout: 10 * time.Second,
210210
ReadTimeout: 30 * time.Second,
@@ -256,7 +256,9 @@ func performAsync(n int, cbs ...func(int)) *sync.WaitGroup {
256256
var wg sync.WaitGroup
257257
for _, cb := range cbs {
258258
wg.Add(n)
259-
for i := 0; i < n; i++ {
259+
// start from 1, so we can skip db 0 where such test is executed with
260+
// select db command
261+
for i := 1; i <= n; i++ {
260262
go func(cb func(int), i int) {
261263
defer GinkgoRecover()
262264
defer wg.Done()

race_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ var _ = Describe("races", func() {
138138
})
139139

140140
It("should select db", Label("NonRedisEnterprise"), func() {
141-
err := client.Set(ctx, "db", 1, 0).Err()
141+
err := client.Set(ctx, "db", 0, 0).Err()
142142
Expect(err).NotTo(HaveOccurred())
143143

144144
perform(C, func(id int) {
@@ -159,7 +159,7 @@ var _ = Describe("races", func() {
159159

160160
n, err := client.Get(ctx, "db").Int64()
161161
Expect(err).NotTo(HaveOccurred())
162-
Expect(n).To(Equal(int64(1)))
162+
Expect(n).To(Equal(int64(0)))
163163
})
164164

165165
It("should select DB with read timeout", func() {

redis_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ var _ = Describe("Client", func() {
6666
})
6767

6868
It("should Stringer", func() {
69-
if RECluster {
70-
Expect(client.String()).To(Equal(fmt.Sprintf("Redis<:%s db:0>", redisPort)))
71-
} else {
72-
Expect(client.String()).To(Equal(fmt.Sprintf("Redis<:%s db:15>", redisPort)))
73-
}
69+
Expect(client.String()).To(Equal(fmt.Sprintf("Redis<:%s db:0>", redisPort)))
7470
})
7571

7672
It("supports context", func() {

0 commit comments

Comments
 (0)