Skip to content

Commit 3c7cc56

Browse files
committed
test(search): default timeout mode for search
The default timeout mode was changed to return from fail. To test the timeout, set it to fail just before testing it.
1 parent a769f52 commit 3c7cc56

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

main_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ var _ = BeforeSuite(func() {
100100

101101
fmt.Printf("RECluster: %v\n", RECluster)
102102
fmt.Printf("RCEDocker: %v\n", RCEDocker)
103-
fmt.Printf("REDIS_VERSION: %v\n", RedisVersion)
103+
fmt.Printf("REDIS_VERSION: %.1f\n", RedisVersion)
104+
fmt.Printf("CLIENT_LIBS_TEST_IMAGE: %v\n", os.Getenv("CLIENT_LIBS_TEST_IMAGE"))
104105

105106
if RedisVersion < 7.0 || RedisVersion > 9 {
106107
panic("incorrect or not supported redis version")

search_test.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
18621862
}
18631863
})
18641864

1865-
It("should stop processing and return an error when a timeout occurs", Label("search", "ftaggregate"), func() {
1865+
FIt("should stop processing and return an error when a timeout occurs", Label("search", "ftaggregate"), func() {
18661866
SkipBeforeRedisVersion(7.9, "requires Redis 8.x")
18671867
val, err := client.FTCreate(ctx, "aggTimeoutHeavy", &redis.FTCreateOptions{},
18681868
&redis.FieldSchema{FieldName: "n", FieldType: redis.SearchFieldTypeNumeric, Sortable: true},
@@ -1871,17 +1871,20 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
18711871
Expect(val).To(BeEquivalentTo("OK"))
18721872
WaitForIndexing(client, "aggTimeoutHeavy")
18731873

1874-
const totalDocs = 10000
1874+
const totalDocs = 100000
18751875
for i := 0; i < totalDocs; i++ {
18761876
key := fmt.Sprintf("doc%d", i)
18771877
_, err := client.HSet(ctx, key, "n", i).Result()
18781878
Expect(err).NotTo(HaveOccurred())
18791879
}
1880+
// default behaviour was changed in 8.0.1, set to fail to validate the timeout was triggered
1881+
err = client.ConfigSet(ctx, "search-on-timeout", "fail").Err()
1882+
Expect(err).NotTo(HaveOccurred())
18801883

18811884
options := &redis.FTAggregateOptions{
18821885
SortBy: []redis.FTAggregateSortBy{{FieldName: "@n", Desc: true}},
18831886
LimitOffset: 0,
1884-
Limit: 100,
1887+
Limit: 100000,
18851888
Timeout: 1, // 1 ms timeout, expected to trigger a timeout error.
18861889
}
18871890
_, err = client.FTAggregateWithArgs(ctx, "aggTimeoutHeavy", "*", options).Result()

0 commit comments

Comments
 (0)