Skip to content

Commit 6cf9bd8

Browse files
authored
Merge branch 'master' into use-hash-tag-in-scan-commands
2 parents 7b39fda + 884f997 commit 6cf9bd8

File tree

38 files changed

+1281
-170
lines changed

38 files changed

+1281
-170
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ runs:
2525
2626
# Mapping of redis version to redis testing containers
2727
declare -A redis_version_mapping=(
28-
["8.0.1"]="8.0.1-pre"
29-
["7.4.2"]="rs-7.4.0-v2"
30-
["7.2.7"]="rs-7.2.0-v14"
28+
["8.0.x"]="8.0.2"
29+
["7.4.x"]="rs-7.4.0-v5"
30+
["7.2.x"]="rs-7.2.0-v17"
3131
)
3232
3333
if [[ -v redis_version_mapping[$REDIS_VERSION] ]]; then

.github/workflows/build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
redis-version:
21-
- "8.0.1" # 8.0.1
22-
- "7.4.2" # should use redis stack 7.4
21+
- "8.0.x" # Redis CE 8.0
22+
- "7.4.x" # Redis stack 7.4
2323
go-version:
2424
- "1.23.x"
2525
- "1.24.x"
@@ -43,8 +43,8 @@ jobs:
4343
4444
# Mapping of redis version to redis testing containers
4545
declare -A redis_version_mapping=(
46-
["8.0.1"]="8.0.1-pre"
47-
["7.4.2"]="rs-7.4.0-v2"
46+
["8.0.x"]="8.0.2"
47+
["7.4.x"]="rs-7.4.0-v5"
4848
)
4949
if [[ -v redis_version_mapping[$REDIS_VERSION] ]]; then
5050
echo "REDIS_VERSION=${redis_version_np}" >> $GITHUB_ENV
@@ -72,9 +72,9 @@ jobs:
7272
fail-fast: false
7373
matrix:
7474
redis-version:
75-
- "8.0.1" # 8.0.1
76-
- "7.4.2" # should use redis stack 7.4
77-
- "7.2.7" # should redis stack 7.2
75+
- "8.0.x" # Redis CE 8.0
76+
- "7.4.x" # Redis stack 7.4
77+
- "7.2.x" # Redis stack 7.2
7878
go-version:
7979
- "1.23.x"
8080
- "1.24.x"

.github/workflows/doctests.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ 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+
image: redislabs/client-libs-test:8.0.2
20+
env:
21+
TLS_ENABLED: no
22+
REDIS_CLUSTER: no
23+
PORT: 6379
2224
ports:
2325
- 6379:6379
2426

@@ -38,4 +40,4 @@ jobs:
3840

3941
- name: Test doc examples
4042
working-directory: ./doctests
41-
run: go test -v
43+
run: make test

.github/workflows/spellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- name: Checkout
99
uses: actions/checkout@v4
1010
- name: Check Spelling
11-
uses: rojopolis/spellcheck-github-actions@0.49.0
11+
uses: rojopolis/spellcheck-github-actions@0.51.0
1212
with:
1313
config_path: .github/spellcheck-settings.yml
1414
task_name: Markdown

Makefile

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@ docker.stop:
88

99
test:
1010
$(MAKE) docker.start
11-
$(MAKE) test.ci
11+
@if [ -z "$(REDIS_VERSION)" ]; then \
12+
echo "REDIS_VERSION not set, running all tests"; \
13+
$(MAKE) test.ci; \
14+
else \
15+
MAJOR_VERSION=$$(echo "$(REDIS_VERSION)" | cut -d. -f1); \
16+
if [ "$$MAJOR_VERSION" -ge 8 ]; then \
17+
echo "REDIS_VERSION $(REDIS_VERSION) >= 8, running all tests"; \
18+
$(MAKE) test.ci; \
19+
else \
20+
echo "REDIS_VERSION $(REDIS_VERSION) < 8, skipping vector_sets tests"; \
21+
$(MAKE) test.ci.skip-vectorsets; \
22+
fi; \
23+
fi
1224
$(MAKE) docker.stop
1325

1426
test.ci:
@@ -17,15 +29,27 @@ test.ci:
1729
(cd "$${dir}" && \
1830
go mod tidy -compat=1.18 && \
1931
go vet && \
20-
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race); \
32+
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race -skip Example); \
33+
done
34+
cd internal/customvet && go build .
35+
go vet -vettool ./internal/customvet/customvet
36+
37+
test.ci.skip-vectorsets:
38+
set -e; for dir in $(GO_MOD_DIRS); do \
39+
echo "go test in $${dir} (skipping vector sets)"; \
40+
(cd "$${dir}" && \
41+
go mod tidy -compat=1.18 && \
42+
go vet && \
43+
go test -v -coverprofile=coverage.txt -covermode=atomic ./... -race \
44+
-run '^(?!.*(?:VectorSet|vectorset|ExampleClient_vectorset)).*$$' -skip Example); \
2145
done
2246
cd internal/customvet && go build .
2347
go vet -vettool ./internal/customvet/customvet
2448

2549
bench:
26-
go test ./... -test.run=NONE -test.bench=. -test.benchmem
50+
go test ./... -test.run=NONE -test.bench=. -test.benchmem -skip Example
2751

28-
.PHONY: all test bench fmt
52+
.PHONY: all test test.ci test.ci.skip-vectorsets bench fmt
2953

3054
build:
3155
go build .

RELEASE-NOTES.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Release Notes
22

3+
# 9.10.0 (2025-06-06)
4+
5+
## 🚀 Highlights
6+
7+
`go-redis` now supports [vector sets](https://redis.io/docs/latest/develop/data-types/vector-sets/). This data type is marked
8+
as "in preview" in Redis and its support in `go-redis` is marked as experimental. You can find examples in the documentation and
9+
in the `doctests` folder.
10+
11+
# Changes
12+
13+
## 🚀 New Features
14+
15+
- feat: support vectorset ([#3375](https://github.com/redis/go-redis/pull/3375))
16+
17+
## 🧰 Maintenance
18+
19+
- Add the missing NewFloatSliceResult for testing ([#3393](https://github.com/redis/go-redis/pull/3393))
20+
- DOC-5078 vector set examples ([#3394](https://github.com/redis/go-redis/pull/3394))
21+
22+
## Contributors
23+
We'd like to thank all the contributors who worked on this release!
24+
25+
[@AndBobsYourUncle](https://github.com/AndBobsYourUncle), [@andy-stark-redis](https://github.com/andy-stark-redis), [@fukua95](https://github.com/fukua95) and [@ndyakov](https://github.com/ndyakov)
26+
27+
28+
329
# 9.9.0 (2025-05-27)
430

531
## 🚀 Highlights

auth/auth_test.go

Lines changed: 84 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package auth
22

33
import (
44
"errors"
5+
"strings"
56
"sync"
67
"testing"
78
"time"
@@ -179,36 +180,90 @@ func TestStreamingCredentialsProvider(t *testing.T) {
179180
}
180181

181182
func TestBasicCredentials(t *testing.T) {
182-
t.Run("basic auth", func(t *testing.T) {
183-
creds := NewBasicCredentials("user1", "pass1")
184-
username, password := creds.BasicAuth()
185-
if username != "user1" {
186-
t.Fatalf("expected username 'user1', got '%s'", username)
187-
}
188-
if password != "pass1" {
189-
t.Fatalf("expected password 'pass1', got '%s'", password)
190-
}
191-
})
192-
193-
t.Run("raw credentials", func(t *testing.T) {
194-
creds := NewBasicCredentials("user1", "pass1")
195-
raw := creds.RawCredentials()
196-
expected := "user1:pass1"
197-
if raw != expected {
198-
t.Fatalf("expected raw credentials '%s', got '%s'", expected, raw)
199-
}
200-
})
183+
tests := []struct {
184+
name string
185+
username string
186+
password string
187+
expectedUser string
188+
expectedPass string
189+
expectedRaw string
190+
}{
191+
{
192+
name: "basic auth",
193+
username: "user1",
194+
password: "pass1",
195+
expectedUser: "user1",
196+
expectedPass: "pass1",
197+
expectedRaw: "user1:pass1",
198+
},
199+
{
200+
name: "empty username",
201+
username: "",
202+
password: "pass1",
203+
expectedUser: "",
204+
expectedPass: "pass1",
205+
expectedRaw: ":pass1",
206+
},
207+
{
208+
name: "empty password",
209+
username: "user1",
210+
password: "",
211+
expectedUser: "user1",
212+
expectedPass: "",
213+
expectedRaw: "user1:",
214+
},
215+
{
216+
name: "both username and password empty",
217+
username: "",
218+
password: "",
219+
expectedUser: "",
220+
expectedPass: "",
221+
expectedRaw: ":",
222+
},
223+
{
224+
name: "special characters",
225+
username: "user:1",
226+
password: "pa:ss@!#",
227+
expectedUser: "user:1",
228+
expectedPass: "pa:ss@!#",
229+
expectedRaw: "user:1:pa:ss@!#",
230+
},
231+
{
232+
name: "unicode characters",
233+
username: "ユーザー",
234+
password: "密碼123",
235+
expectedUser: "ユーザー",
236+
expectedPass: "密碼123",
237+
expectedRaw: "ユーザー:密碼123",
238+
},
239+
{
240+
name: "long credentials",
241+
username: strings.Repeat("u", 1000),
242+
password: strings.Repeat("p", 1000),
243+
expectedUser: strings.Repeat("u", 1000),
244+
expectedPass: strings.Repeat("p", 1000),
245+
expectedRaw: strings.Repeat("u", 1000) + ":" + strings.Repeat("p", 1000),
246+
},
247+
}
201248

202-
t.Run("empty username", func(t *testing.T) {
203-
creds := NewBasicCredentials("", "pass1")
204-
username, password := creds.BasicAuth()
205-
if username != "" {
206-
t.Fatalf("expected empty username, got '%s'", username)
207-
}
208-
if password != "pass1" {
209-
t.Fatalf("expected password 'pass1', got '%s'", password)
210-
}
211-
})
249+
for _, tt := range tests {
250+
t.Run(tt.name, func(t *testing.T) {
251+
creds := NewBasicCredentials(tt.username, tt.password)
252+
253+
user, pass := creds.BasicAuth()
254+
if user != tt.expectedUser {
255+
t.Errorf("BasicAuth() username = %q; want %q", user, tt.expectedUser)
256+
}
257+
if pass != tt.expectedPass {
258+
t.Errorf("BasicAuth() password = %q; want %q", pass, tt.expectedPass)
259+
}
260+
261+
raw := creds.RawCredentials()
262+
if raw != tt.expectedRaw {
263+
t.Errorf("RawCredentials() = %q; want %q", raw, tt.expectedRaw)
264+
}
265+
})
266+
}
212267
}
213268

214269
func TestReAuthCredentialsListener(t *testing.T) {

command.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3584,15 +3584,14 @@ func (c *cmdsInfoCache) Get(ctx context.Context) (map[string]*CommandInfo, error
35843584
return err
35853585
}
35863586

3587+
lowerCmds := make(map[string]*CommandInfo, len(cmds))
3588+
35873589
// Extensions have cmd names in upper case. Convert them to lower case.
35883590
for k, v := range cmds {
3589-
lower := internal.ToLower(k)
3590-
if lower != k {
3591-
cmds[lower] = v
3592-
}
3591+
lowerCmds[internal.ToLower(k)] = v
35933592
}
35943593

3595-
c.cmds = cmds
3594+
c.cmds = lowerCmds
35963595
return nil
35973596
})
35983597
return c.cmds, err

commands_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ var _ = Describe("Commands", func() {
460460
}
461461

462462
// read the defaults to set them back later
463-
for setting, _ := range expected {
463+
for setting := range expected {
464464
val, err := client.ConfigGet(ctx, setting).Result()
465465
Expect(err).NotTo(HaveOccurred())
466466
defaults[setting] = val[setting]

doctests/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
test:
2+
@if [ -z "$(REDIS_VERSION)" ]; then \
3+
echo "REDIS_VERSION not set, running all tests"; \
4+
go test -v ./...; \
5+
else \
6+
MAJOR_VERSION=$$(echo "$(REDIS_VERSION)" | cut -d. -f1); \
7+
if [ "$$MAJOR_VERSION" -ge 8 ]; then \
8+
echo "REDIS_VERSION $(REDIS_VERSION) >= 8, running all tests"; \
9+
go test -v ./...; \
10+
else \
11+
echo "REDIS_VERSION $(REDIS_VERSION) < 8, skipping vector_sets tests"; \
12+
go test -v ./... -run '^(?!.*(?:vectorset|ExampleClient_vectorset)).*$$'; \
13+
fi; \
14+
fi
15+
16+
.PHONY: test

0 commit comments

Comments
 (0)