Skip to content

Commit d54258f

Browse files
committed
wip(tests): run doctests for vector sets on redis 8 only
1 parent e81a330 commit d54258f

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

.github/workflows/doctests.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ jobs:
1616

1717
services:
1818
redis-stack:
19-
image: redis/redis-stack-server:latest
20-
options: >-
21-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
19+
platform: arm64
20+
image: redislabs/client-libs-test:8.0.1-pre
21+
env:
22+
TLS_ENABLED: no
23+
REDIS_CLUSTER: no
24+
PORT: 6379
2225
ports:
2326
- 6379:6379
2427

doctests/main_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package example_commands_test
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"strconv"
7+
"strings"
8+
)
9+
10+
var RedisVersion float64
11+
12+
func init() {
13+
// read REDIS_VERSION from env
14+
RedisVersion, _ = strconv.ParseFloat(strings.Trim(os.Getenv("REDIS_VERSION"), "\""), 64)
15+
fmt.Printf("REDIS_VERSION: %.1f\n", RedisVersion)
16+
}

doctests/vec_set_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import (
1313
// HIDE_END
1414

1515
func ExampleClient_vectorset() {
16+
// HIDE_START
17+
if RedisVersion < 8.0 {
18+
return
19+
}
20+
// HIDE_END
1621
ctx := context.Background()
1722

1823
rdb := redis.NewClient(&redis.Options{
@@ -381,6 +386,11 @@ func ExampleClient_vectorset() {
381386
}
382387

383388
func ExampleClient_vectorset_quantization() {
389+
// HIDE_START
390+
if RedisVersion < 8.0 {
391+
return
392+
}
393+
// HIDE_END
384394
ctx := context.Background()
385395

386396
rdb := redis.NewClient(&redis.Options{
@@ -474,6 +484,11 @@ func ExampleClient_vectorset_quantization() {
474484
}
475485

476486
func ExampleClient_vectorset_dimension_reduction() {
487+
// HIDE_START
488+
if RedisVersion < 8.0 {
489+
return
490+
}
491+
// HIDE_END
477492
ctx := context.Background()
478493

479494
rdb := redis.NewClient(&redis.Options{

0 commit comments

Comments
 (0)