From d9eeed131a32b4aeaf1e1915b6717f8cd2af9124 Mon Sep 17 00:00:00 2001 From: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:11:59 +0300 Subject: [PATCH] Fix Flaky Test: should handle FTAggregate with Unstable RESP3 Search Module and without stability (#3135) --- go.mod | 2 +- search_test.go | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index bd13d745..c1d9037a 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,6 @@ require ( ) retract ( - v9.5.3 // This version was accidentally released. Please use version 9.6.0 instead. v9.5.4 // This version was accidentally released. Please use version 9.6.0 instead. + v9.5.3 // This version was accidentally released. Please use version 9.6.0 instead. ) diff --git a/search_test.go b/search_test.go index 93859a4e..efdc6bb1 100644 --- a/search_test.go +++ b/search_test.go @@ -1446,16 +1446,18 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() { options := &redis.FTAggregateOptions{Apply: []redis.FTAggregateApply{{Field: "@CreatedDateTimeUTC * 10", As: "CreatedDateTimeUTC"}}} res, err := client.FTAggregateWithArgs(ctx, "idx1", "*", options).RawResult() - rawVal := client.FTAggregateWithArgs(ctx, "idx1", "*", options).RawVal() - - Expect(err).NotTo(HaveOccurred()) - Expect(rawVal).To(BeEquivalentTo(res)) results := res.(map[interface{}]interface{})["results"].([]interface{}) Expect(results[0].(map[interface{}]interface{})["extra_attributes"].(map[interface{}]interface{})["CreatedDateTimeUTC"]). To(Or(BeEquivalentTo("6373878785249699840"), BeEquivalentTo("6373878758592700416"))) Expect(results[1].(map[interface{}]interface{})["extra_attributes"].(map[interface{}]interface{})["CreatedDateTimeUTC"]). To(Or(BeEquivalentTo("6373878785249699840"), BeEquivalentTo("6373878758592700416"))) + rawVal := client.FTAggregateWithArgs(ctx, "idx1", "*", options).RawVal() + rawValResults := rawVal.(map[interface{}]interface{})["results"].([]interface{}) + Expect(err).NotTo(HaveOccurred()) + Expect(rawValResults[0]).To(Or(BeEquivalentTo(results[0]), BeEquivalentTo(results[1]))) + Expect(rawValResults[1]).To(Or(BeEquivalentTo(results[0]), BeEquivalentTo(results[1]))) + // Test with UnstableResp3 false Expect(func() { options = &redis.FTAggregateOptions{Apply: []redis.FTAggregateApply{{Field: "@CreatedDateTimeUTC * 10", As: "CreatedDateTimeUTC"}}}