From 53bd68c882fe6aea3d889ac718fd89121e869359 Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Fri, 31 Jan 2025 11:09:59 +0200 Subject: [PATCH 1/5] Add tests for unified config in Redis 8 --- .gitignore | 1 + commands_test.go | 75 ++++++++++++++++++++++++++++++++++++++++++++++ main_test.go | 30 ++++++++++++++----- search_commands.go | 24 +++++++++++---- search_test.go | 9 ++---- 5 files changed, 120 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 63b21b0b48..f1883206a7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ testdata/* .DS_Store *.tar.gz *.dic +redis8tests.sh diff --git a/commands_test.go b/commands_test.go index 901e96e35e..8f9261b0a2 100644 --- a/commands_test.go +++ b/commands_test.go @@ -344,6 +344,23 @@ var _ = Describe("Commands", func() { Expect(val).NotTo(BeEmpty()) }) + It("should ConfigGet Modules", func() { + SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") + expected := map[string]string{ + "search-*": "search-min-prefix", + "ts-*": "ts-retention-policy", + "bf-*": "bf-error-rate", + "cf-*": "cf-initial-size", + } + + for prefix, lookup := range expected { + val, err := client.ConfigGet(ctx, prefix).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(val).NotTo(BeEmpty()) + Expect(val[lookup]).NotTo(BeEmpty()) + } + }) + It("should ConfigResetStat", Label("NonRedisEnterprise"), func() { r := client.ConfigResetStat(ctx) Expect(r.Err()).NotTo(HaveOccurred()) @@ -362,6 +379,64 @@ var _ = Describe("Commands", func() { Expect(configSet.Val()).To(Equal("OK")) }) + It("should ConfigSet Modules", func() { + SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") + defaults := map[string]string{} + expected := map[string]string{ + "search-min-prefix": "32", + "ts-retention-policy": "2", + "bf-error-rate": "0.13", + "cf-initial-size": "64", + } + + // read the defaults to set them back later + for setting, _ := range expected { + val, err := client.ConfigGet(ctx, setting).Result() + Expect(err).NotTo(HaveOccurred()) + defaults[setting] = val[setting] + } + + // check if new values can be set + for setting, value := range expected { + val, err := client.ConfigSet(ctx, setting, value).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(val).NotTo(BeEmpty()) + Expect(val).To(Equal("OK")) + } + + for setting, value := range expected { + val, err := client.ConfigGet(ctx, setting).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(val).NotTo(BeEmpty()) + Expect(val[setting]).To(Equal(value)) + } + + // set back to the defaults + for setting, value := range defaults { + val, err := client.ConfigSet(ctx, setting, value).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(val).NotTo(BeEmpty()) + Expect(val).To(Equal("OK")) + } + }) + + It("should Fail ConfigSet Modules", func() { + SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") + expected := map[string]string{ + "search-min-prefix": "-32", + "ts-retention-policy": "-10", + "bf-error-rate": "1.5", + "cf-initial-size": "-10", + } + + for setting, value := range expected { + val, err := client.ConfigSet(ctx, setting, value).Result() + Expect(err).To(HaveOccurred()) + Expect(err).To(MatchError(ContainSubstring(setting))) + Expect(val).To(BeEmpty()) + } + }) + It("should ConfigRewrite", Label("NonRedisEnterprise"), func() { configRewrite := client.ConfigRewrite(ctx) Expect(configRewrite.Err()).NotTo(HaveOccurred()) diff --git a/main_test.go b/main_test.go index 6b3b563a02..a326960a0f 100644 --- a/main_test.go +++ b/main_test.go @@ -73,7 +73,19 @@ var RCEDocker = false // Notes the major version of redis we are executing tests. // This can be used before we change the bsm fork of ginkgo for one, // which have support for label sets, so we can filter tests per redis major version. -var REDIS_MAJOR_VERSION = 7 +var RedisMajorVersion = 7 + +func SkipBeforeRedisMajor(version int, msg string) { + if RedisMajorVersion < version { + Skip(fmt.Sprintf("(redis major version < %d) %s", version, msg)) + } +} + +func SkipAfterRedisMajor(version int, msg string) { + if RedisMajorVersion > version { + Skip(fmt.Sprintf("(redis major version > %d) %s", version, msg)) + } +} func registerProcess(port string, p *redisProcess) { if processes == nil { @@ -92,16 +104,20 @@ var _ = BeforeSuite(func() { RECluster, _ = strconv.ParseBool(os.Getenv("RE_CLUSTER")) RCEDocker, _ = strconv.ParseBool(os.Getenv("RCE_DOCKER")) - REDIS_MAJOR_VERSION, _ = strconv.Atoi(os.Getenv("REDIS_MAJOR_VERSION")) - if REDIS_MAJOR_VERSION == 0 { - REDIS_MAJOR_VERSION = 7 + RedisMajorVersion, _ = strconv.Atoi(os.Getenv("REDIS_MAJOR_VERSION")) + + if RedisMajorVersion == 0 { + RedisMajorVersion = 7 } - Expect(REDIS_MAJOR_VERSION).To(BeNumerically(">=", 6)) - Expect(REDIS_MAJOR_VERSION).To(BeNumerically("<=", 8)) fmt.Printf("RECluster: %v\n", RECluster) fmt.Printf("RCEDocker: %v\n", RCEDocker) - fmt.Printf("REDIS_MAJOR_VERSION: %v\n", REDIS_MAJOR_VERSION) + fmt.Printf("REDIS_MAJOR_VERSION: %v\n", RedisMajorVersion) + + if RedisMajorVersion < 6 || RedisMajorVersion > 8 { + panic("incorrect or not supported redis major version") + } + if !RECluster && !RCEDocker { redisMain, err = startRedis(redisPort) diff --git a/search_commands.go b/search_commands.go index 9e5928017a..a2443291b5 100644 --- a/search_commands.go +++ b/search_commands.go @@ -831,20 +831,32 @@ func (c cmdable) FTAlter(ctx context.Context, index string, skipInitialScan bool return cmd } -// FTConfigGet - Retrieves the value of a RediSearch configuration parameter. +// Deprecated: FTConfigGet is deprecated in Redis 8. +// All configuration will be done with the CONFIG GET command. +// For more information check [Client.ConfigGet] and [CONFIG GET Documentation] +// +// Retrieves the value of a RediSearch configuration parameter. // The 'option' parameter specifies the configuration parameter to retrieve. -// For more information, please refer to the Redis documentation: -// [FT.CONFIG GET]: (https://redis.io/commands/ft.config-get/) +// For more information, please refer to the Redis [FT.CONFIG GET] documentation. +// +// [CONFIG GET Documentation]: https://redis.io/commands/config-get/ +// [FT.CONFIG GET]: https://redis.io/commands/ft.config-get/ func (c cmdable) FTConfigGet(ctx context.Context, option string) *MapMapStringInterfaceCmd { cmd := NewMapMapStringInterfaceCmd(ctx, "FT.CONFIG", "GET", option) _ = c(ctx, cmd) return cmd } -// FTConfigSet - Sets the value of a RediSearch configuration parameter. +// Deprecated: FTConfigSet is deprecated in Redis 8. +// All configuration will be done with the CONFIG SET command. +// For more information check [Client.ConfigSet] and [CONFIG SET Documentation] +// +// Sets the value of a RediSearch configuration parameter. // The 'option' parameter specifies the configuration parameter to set, and the 'value' parameter specifies the new value. -// For more information, please refer to the Redis documentation: -// [FT.CONFIG SET]: (https://redis.io/commands/ft.config-set/) +// For more information, please refer to the Redis [FT.CONFIG SET] documentation. +// +// [CONFIG SET Documentation]: https://redis.io/commands/config-set/ +// [FT.CONFIG SET]: https://redis.io/commands/ft.config-set/ func (c cmdable) FTConfigSet(ctx context.Context, option string, value interface{}) *StatusCmd { cmd := NewStatusCmd(ctx, "FT.CONFIG", "SET", option, value) _ = c(ctx, cmd) diff --git a/search_test.go b/search_test.go index a48f45bf0f..b6a6476df0 100644 --- a/search_test.go +++ b/search_test.go @@ -374,9 +374,8 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() { // up until redis 8 the default scorer was TFIDF, in redis 8 it is BM25 // this test expect redis major version >= 8 It("should FTSearch WithScores", Label("search", "ftsearch"), func() { - if REDIS_MAJOR_VERSION < 8 { - Skip("(redis major version < 8) default scorer is not BM25") - } + SkipBeforeRedisMajor(8, "default scorer is not BM25") + text1 := &redis.FieldSchema{FieldName: "description", FieldType: redis.SearchFieldTypeText} val, err := client.FTCreate(ctx, "idx1", &redis.FTCreateOptions{}, text1).Result() Expect(err).NotTo(HaveOccurred()) @@ -418,9 +417,7 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() { // up until redis 8 the default scorer was TFIDF, in redis 8 it is BM25 // this test expect redis major version <=7 It("should FTSearch WithScores", Label("search", "ftsearch"), func() { - if REDIS_MAJOR_VERSION > 7 { - Skip("(redis major version > 7) default scorer is not TFIDF") - } + SkipAfterRedisMajor(7, "default scorer is not TFIDF") text1 := &redis.FieldSchema{FieldName: "description", FieldType: redis.SearchFieldTypeText} val, err := client.FTCreate(ctx, "idx1", &redis.FTCreateOptions{}, text1).Result() Expect(err).NotTo(HaveOccurred()) From 11d6421a5933a35e591049fb173d3db25a53a688 Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Sat, 1 Feb 2025 00:51:51 +0200 Subject: [PATCH 2/5] WIP: fix reading FT.CONFIG with RESP3 --- command.go | 47 +++++++++++++++++++++++++++------------- commands_test.go | 56 ++++++++++++++++++++++++++++++++++++++++++++++-- search_test.go | 2 ++ 3 files changed, 88 insertions(+), 17 deletions(-) diff --git a/command.go b/command.go index f5aad91494..b9950422f4 100644 --- a/command.go +++ b/command.go @@ -3863,29 +3863,46 @@ func (cmd *MapMapStringInterfaceCmd) Val() map[string]interface{} { } func (cmd *MapMapStringInterfaceCmd) readReply(rd *proto.Reader) (err error) { - n, err := rd.ReadArrayLen() + data, err := rd.ReadReply() if err != nil { return err } + resultMap := map[string]interface{}{} - data := make(map[string]interface{}, n/2) - for i := 0; i < n; i += 2 { - _, err := rd.ReadArrayLen() - if err != nil { - cmd.err = err - } - key, err := rd.ReadString() - if err != nil { - cmd.err = err + switch midResponse := data.(type) { + case map[interface{}]interface{}: + for k, v := range midResponse { + stringKey, ok := k.(string) + if !ok { + return fmt.Errorf("redis: invalid map key %#v", k) + } + resultMap[stringKey] = v } - value, err := rd.ReadString() - if err != nil { - cmd.err = err + case []interface{}: // resp2 + n := len(midResponse) + for i := 0; i < n; i++ { + finalArr, ok := midResponse[i].([]interface{}) + if !ok { + return fmt.Errorf("redis: unexpected response %#v", data) + } + m := len(finalArr) + if m%2 != 0 { + return fmt.Errorf("redis: unexpected response %#v", data) + } + + for j := 0; j < m; j += 2 { + stringKey, ok := finalArr[j].(string) + if !ok { + return fmt.Errorf("redis: invalid map key %#v", finalArr[i]) + } + resultMap[stringKey] = finalArr[j+1] + } } - data[key] = value + default: + return fmt.Errorf("redis: unexpected response %#v", data) } - cmd.val = data + cmd.val = resultMap return nil } diff --git a/commands_test.go b/commands_test.go index 8f9261b0a2..d2079b0a81 100644 --- a/commands_test.go +++ b/commands_test.go @@ -379,11 +379,63 @@ var _ = Describe("Commands", func() { Expect(configSet.Val()).To(Equal("OK")) }) + It("should ConfigSet FT DIALECT", func() { + SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") + defaultState, err := client.ConfigGet(ctx, "search-default-dialect").Result() + Expect(err).NotTo(HaveOccurred()) + + // set to 3 + res, err := client.ConfigSet(ctx, "search-default-dialect", "3").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(res).To(BeEquivalentTo("OK")) + + defDialect, err := client.FTConfigGet(ctx, "DEFAULT_DIALECT").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(defDialect).To(BeEquivalentTo(map[string]interface{}{"DEFAULT_DIALECT": "3"})) + + resGet, err := client.ConfigGet(ctx, "search-default-dialect").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(resGet).To(BeEquivalentTo(map[string]string{"search-default-dialect": "3"})) + + // set to 2 + res, err = client.ConfigSet(ctx, "search-default-dialect", "2").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(res).To(BeEquivalentTo("OK")) + + defDialect, err = client.FTConfigGet(ctx, "DEFAULT_DIALECT").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(defDialect).To(BeEquivalentTo(map[string]interface{}{"DEFAULT_DIALECT": "2"})) + + // set to 1 + res, err = client.ConfigSet(ctx, "search-default-dialect", "1").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(res).To(BeEquivalentTo("OK")) + + defDialect, err = client.FTConfigGet(ctx, "DEFAULT_DIALECT").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(defDialect).To(BeEquivalentTo(map[string]interface{}{"DEFAULT_DIALECT": "1"})) + + resGet, err = client.ConfigGet(ctx, "search-default-dialect").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(resGet).To(BeEquivalentTo(map[string]string{"search-default-dialect": "1"})) + + // set to default + res, err = client.ConfigSet(ctx, "search-default-dialect", defaultState["search-default-dialect"]).Result() + Expect(err).NotTo(HaveOccurred()) + Expect(res).To(BeEquivalentTo("OK")) + }) + + It("should ConfigSet fail for ReadOnly", func() { + SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") + _, err := client.ConfigSet(ctx, "search-max-doctablesize", "100000").Result() + Expect(err).To(HaveOccurred()) + }) + It("should ConfigSet Modules", func() { SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") defaults := map[string]string{} expected := map[string]string{ - "search-min-prefix": "32", + "search-timeout": "100", "ts-retention-policy": "2", "bf-error-rate": "0.13", "cf-initial-size": "64", @@ -423,7 +475,7 @@ var _ = Describe("Commands", func() { It("should Fail ConfigSet Modules", func() { SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") expected := map[string]string{ - "search-min-prefix": "-32", + "search-timeout": "-100", "ts-retention-policy": "-10", "bf-error-rate": "1.5", "cf-initial-size": "-10", diff --git a/search_test.go b/search_test.go index b6a6476df0..bb1392e201 100644 --- a/search_test.go +++ b/search_test.go @@ -457,6 +457,7 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() { }) It("should FTConfigSet and FTConfigGet ", Label("search", "ftconfigget", "ftconfigset", "NonRedisEnterprise"), func() { + SkipAfterRedisMajor(7, "FT.CONFIG is moved to Config for redis 8") val, err := client.FTConfigSet(ctx, "TIMEOUT", "100").Result() Expect(err).NotTo(HaveOccurred()) Expect(val).To(BeEquivalentTo("OK")) @@ -1013,6 +1014,7 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() { }) It("should FTConfigSet and FTConfigGet dialect", Label("search", "ftconfigget", "ftconfigset", "NonRedisEnterprise"), func() { + SkipAfterRedisMajor(7, "FT.CONFIG is moved to Config for redis 8") res, err := client.FTConfigSet(ctx, "DEFAULT_DIALECT", "1").Result() Expect(err).NotTo(HaveOccurred()) Expect(res).To(BeEquivalentTo("OK")) From 201a5703cdd2618606c43ec90494c475eedcb9dc Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Sat, 1 Feb 2025 03:03:16 +0200 Subject: [PATCH 3/5] add more tests --- command.go | 13 ++++++----- commands_test.go | 13 ++++++++++- search_test.go | 60 ++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/command.go b/command.go index b9950422f4..2623a23960 100644 --- a/command.go +++ b/command.go @@ -3862,6 +3862,7 @@ func (cmd *MapMapStringInterfaceCmd) Val() map[string]interface{} { return cmd.val } +// readReply will try to parse the reply from the proto.Reader for both resp2 and resp3 func (cmd *MapMapStringInterfaceCmd) readReply(rd *proto.Reader) (err error) { data, err := rd.ReadReply() if err != nil { @@ -3870,7 +3871,7 @@ func (cmd *MapMapStringInterfaceCmd) readReply(rd *proto.Reader) (err error) { resultMap := map[string]interface{}{} switch midResponse := data.(type) { - case map[interface{}]interface{}: + case map[interface{}]interface{}: // resp3 will return map for k, v := range midResponse { stringKey, ok := k.(string) if !ok { @@ -3878,24 +3879,24 @@ func (cmd *MapMapStringInterfaceCmd) readReply(rd *proto.Reader) (err error) { } resultMap[stringKey] = v } - case []interface{}: // resp2 + case []interface{}: // resp2 will return array of arrays n := len(midResponse) for i := 0; i < n; i++ { - finalArr, ok := midResponse[i].([]interface{}) + finalArr, ok := midResponse[i].([]interface{}) // final array that we need to transform to map if !ok { return fmt.Errorf("redis: unexpected response %#v", data) } m := len(finalArr) - if m%2 != 0 { + if m%2 != 0 { // since this should be map, keys should be even number return fmt.Errorf("redis: unexpected response %#v", data) } for j := 0; j < m; j += 2 { - stringKey, ok := finalArr[j].(string) + stringKey, ok := finalArr[j].(string) // the first one if !ok { return fmt.Errorf("redis: invalid map key %#v", finalArr[i]) } - resultMap[stringKey] = finalArr[j+1] + resultMap[stringKey] = finalArr[j+1] // second one is value } } default: diff --git a/commands_test.go b/commands_test.go index d2079b0a81..270cd56a14 100644 --- a/commands_test.go +++ b/commands_test.go @@ -379,8 +379,19 @@ var _ = Describe("Commands", func() { Expect(configSet.Val()).To(Equal("OK")) }) + It("should ConfigGet with Modules", Label("NonRedisEnterprise"), func() { + SkipBeforeRedisMajor(8, "config get won't return modules configs before redis 8") + configGet := client.ConfigGet(ctx, "*") + Expect(configGet.Err()).NotTo(HaveOccurred()) + Expect(configGet.Val()).To(HaveKey("maxmemory")) + Expect(configGet.Val()).To(HaveKey("search-timeout")) + Expect(configGet.Val()).To(HaveKey("ts-retention-policy")) + Expect(configGet.Val()).To(HaveKey("bf-error-rate")) + Expect(configGet.Val()).To(HaveKey("cf-initial-size")) + }) + It("should ConfigSet FT DIALECT", func() { - SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") + SkipBeforeRedisMajor(8, "config doesn't include modules before Redis 8") defaultState, err := client.ConfigGet(ctx, "search-default-dialect").Result() Expect(err).NotTo(HaveOccurred()) diff --git a/search_test.go b/search_test.go index bb1392e201..0a06ffef8e 100644 --- a/search_test.go +++ b/search_test.go @@ -457,7 +457,6 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() { }) It("should FTConfigSet and FTConfigGet ", Label("search", "ftconfigget", "ftconfigset", "NonRedisEnterprise"), func() { - SkipAfterRedisMajor(7, "FT.CONFIG is moved to Config for redis 8") val, err := client.FTConfigSet(ctx, "TIMEOUT", "100").Result() Expect(err).NotTo(HaveOccurred()) Expect(val).To(BeEquivalentTo("OK")) @@ -1013,8 +1012,25 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() { }) + It("should FTConfigGet return multiple fields", Label("search", "NonRedisEnterprise"), func() { + res, err := client.FTConfigSet(ctx, "DEFAULT_DIALECT", "1").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(res).To(BeEquivalentTo("OK")) + + defDialect, err := client.FTConfigGet(ctx, "DEFAULT_DIALECT").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(defDialect).To(BeEquivalentTo(map[string]interface{}{"DEFAULT_DIALECT": "1"})) + + res, err = client.FTConfigSet(ctx, "DEFAULT_DIALECT", "2").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(res).To(BeEquivalentTo("OK")) + + defDialect, err = client.FTConfigGet(ctx, "DEFAULT_DIALECT").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(defDialect).To(BeEquivalentTo(map[string]interface{}{"DEFAULT_DIALECT": "2"})) + }) + It("should FTConfigSet and FTConfigGet dialect", Label("search", "ftconfigget", "ftconfigset", "NonRedisEnterprise"), func() { - SkipAfterRedisMajor(7, "FT.CONFIG is moved to Config for redis 8") res, err := client.FTConfigSet(ctx, "DEFAULT_DIALECT", "1").Result() Expect(err).NotTo(HaveOccurred()) Expect(res).To(BeEquivalentTo("OK")) @@ -1470,6 +1486,46 @@ func _assert_geosearch_result(result *redis.FTSearchResult, expectedDocIDs []str // Expect(results0["extra_attributes"].(map[interface{}]interface{})["__v_score"]).To(BeEquivalentTo("0")) // }) +var _ = Describe("RediSearch FT.Config with Resp2 and Resp3", Label("search", "NonRedisEnterprise"), func() { + + var clientResp2 *redis.Client + var clientResp3 *redis.Client + BeforeEach(func() { + clientResp2 = redis.NewClient(&redis.Options{Addr: ":6379", Protocol: 2}) + clientResp3 = redis.NewClient(&redis.Options{Addr: ":6379", Protocol: 3, UnstableResp3: true}) + Expect(clientResp3.FlushDB(ctx).Err()).NotTo(HaveOccurred()) + }) + + AfterEach(func() { + Expect(clientResp2.Close()).NotTo(HaveOccurred()) + Expect(clientResp3.Close()).NotTo(HaveOccurred()) + }) + + It("should FTConfigSet and FTConfigGet ", Label("search", "ftconfigget", "ftconfigset", "NonRedisEnterprise"), func() { + val, err := clientResp3.FTConfigSet(ctx, "TIMEOUT", "100").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(val).To(BeEquivalentTo("OK")) + + res2, err := clientResp2.FTConfigGet(ctx, "TIMEOUT").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(res2).To(BeEquivalentTo(map[string]interface{}{"TIMEOUT": "100"})) + + res3, err := clientResp3.FTConfigGet(ctx, "TIMEOUT").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(res3).To(BeEquivalentTo(map[string]interface{}{"TIMEOUT": "100"})) + }) + + It("should FTConfigGet all resp2 and resp3", Label("search", "NonRedisEnterprise"), func() { + res2, err := clientResp2.FTConfigGet(ctx, "*").Result() + Expect(err).NotTo(HaveOccurred()) + + res3, err := clientResp3.FTConfigGet(ctx, "*").Result() + Expect(err).NotTo(HaveOccurred()) + Expect(len(res3)).To(BeEquivalentTo(len(res2))) + Expect(res2["DEFAULT_DIALECT"]).To(BeEquivalentTo(res2["DEFAULT_DIALECT"])) + }) +}) + var _ = Describe("RediSearch commands Resp 3", Label("search"), func() { ctx := context.TODO() var client *redis.Client From 1defc39fa075108801d658c4017e5487d9bfaa2f Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Mon, 3 Feb 2025 15:02:51 +0200 Subject: [PATCH 4/5] use search-timeout --- commands_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands_test.go b/commands_test.go index 270cd56a14..dacc7f3d52 100644 --- a/commands_test.go +++ b/commands_test.go @@ -347,7 +347,7 @@ var _ = Describe("Commands", func() { It("should ConfigGet Modules", func() { SkipBeforeRedisMajor(8, "Config doesn't include modules before Redis 8") expected := map[string]string{ - "search-*": "search-min-prefix", + "search-*": "search-timeout", "ts-*": "ts-retention-policy", "bf-*": "bf-error-rate", "cf-*": "cf-initial-size", From a1d71dda25a6b2953c7712771d4dc592572727e1 Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Mon, 3 Feb 2025 16:08:22 +0200 Subject: [PATCH 5/5] move deprecated warnings on the bottom --- search_commands.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/search_commands.go b/search_commands.go index a2443291b5..1312a78f09 100644 --- a/search_commands.go +++ b/search_commands.go @@ -831,14 +831,14 @@ func (c cmdable) FTAlter(ctx context.Context, index string, skipInitialScan bool return cmd } -// Deprecated: FTConfigGet is deprecated in Redis 8. -// All configuration will be done with the CONFIG GET command. -// For more information check [Client.ConfigGet] and [CONFIG GET Documentation] -// // Retrieves the value of a RediSearch configuration parameter. // The 'option' parameter specifies the configuration parameter to retrieve. // For more information, please refer to the Redis [FT.CONFIG GET] documentation. // +// Deprecated: FTConfigGet is deprecated in Redis 8. +// All configuration will be done with the CONFIG GET command. +// For more information check [Client.ConfigGet] and [CONFIG GET Documentation] +// // [CONFIG GET Documentation]: https://redis.io/commands/config-get/ // [FT.CONFIG GET]: https://redis.io/commands/ft.config-get/ func (c cmdable) FTConfigGet(ctx context.Context, option string) *MapMapStringInterfaceCmd { @@ -847,14 +847,14 @@ func (c cmdable) FTConfigGet(ctx context.Context, option string) *MapMapStringIn return cmd } -// Deprecated: FTConfigSet is deprecated in Redis 8. -// All configuration will be done with the CONFIG SET command. -// For more information check [Client.ConfigSet] and [CONFIG SET Documentation] -// // Sets the value of a RediSearch configuration parameter. // The 'option' parameter specifies the configuration parameter to set, and the 'value' parameter specifies the new value. // For more information, please refer to the Redis [FT.CONFIG SET] documentation. // +// Deprecated: FTConfigSet is deprecated in Redis 8. +// All configuration will be done with the CONFIG SET command. +// For more information check [Client.ConfigSet] and [CONFIG SET Documentation] +// // [CONFIG SET Documentation]: https://redis.io/commands/config-set/ // [FT.CONFIG SET]: https://redis.io/commands/ft.config-set/ func (c cmdable) FTConfigSet(ctx context.Context, option string, value interface{}) *StatusCmd {