Skip to content

Commit 56e6478

Browse files
authored
Merge branch 'master' into master
2 parents 4e99ec9 + 37accb4 commit 56e6478

File tree

101 files changed

+13891
-2882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+13891
-2882
lines changed

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: 'Run go-redis tests'
2+
description: 'Runs go-redis tests against different Redis versions and configurations'
3+
inputs:
4+
go-version:
5+
description: 'Go version to use for running tests'
6+
default: '1.23'
7+
redis-version:
8+
description: 'Redis version to test against'
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up ${{ inputs.go-version }}
14+
uses: actions/setup-go@v5
15+
with:
16+
go-version: ${{ inputs.go-version }}
17+
18+
- name: Setup Test environment
19+
env:
20+
REDIS_VERSION: ${{ inputs.redis-version }}
21+
CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ inputs.redis-version }}"
22+
run: |
23+
set -e
24+
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
25+
if (( redis_major_version < 8 )); then
26+
echo "Using redis-stack for module tests"
27+
else
28+
echo "Using redis CE for module tests"
29+
fi
30+
31+
# Mapping of redis version to redis testing containers
32+
declare -A redis_version_mapping=(
33+
["8.0-M03"]="8.0-M04-pre"
34+
["7.4.2"]="rs-7.4.0-v2"
35+
["7.2.7"]="rs-7.2.0-v14"
36+
)
37+
38+
if [[ -v redis_version_mapping[$REDIS_VERSION] ]]; then
39+
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
40+
echo "REDIS_IMAGE=redis:${{ inputs.redis-version }}" >> $GITHUB_ENV
41+
echo "CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:${redis_version_mapping[$REDIS_VERSION]}" >> $GITHUB_ENV
42+
else
43+
echo "Version not found in the mapping."
44+
exit 1
45+
fi
46+
sleep 10 # time to settle
47+
shell: bash
48+
- name: Set up Docker Compose environment with redis ${{ inputs.redis-version }}
49+
run: docker compose --profile all up -d
50+
shell: bash
51+
- name: Run tests
52+
env:
53+
RCE_DOCKER: "true"
54+
RE_CLUSTER: "false"
55+
run: |
56+
go test \
57+
--ginkgo.skip-file="ring_test.go" \
58+
--ginkgo.skip-file="sentinel_test.go" \
59+
--ginkgo.skip-file="pubsub_test.go" \
60+
--ginkgo.skip-file="gears_commands_test.go" \
61+
--ginkgo.label-filter="!NonRedisEnterprise"
62+
shell: bash

.github/wordlist.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ACLs
2+
APIs
23
autoload
34
autoloader
45
autoloading
@@ -46,11 +47,14 @@ runtime
4647
SHA
4748
sharding
4849
SETNAME
50+
SpellCheck
4951
SSL
5052
struct
5153
stunnel
54+
SynDump
5255
TCP
5356
TLS
57+
UnstableResp
5458
uri
5559
URI
5660
url
@@ -59,3 +63,5 @@ RedisStack
5963
RedisGears
6064
RedisTimeseries
6165
RediSearch
66+
RawResult
67+
RawVal

.github/workflows/build.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
go-version: [1.19.x, 1.20.x, 1.21.x]
20-
21-
services:
22-
redis:
23-
image: redis/redis-stack-server:latest
24-
options: >-
25-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
26-
ports:
27-
- 6379:6379
19+
go-version: [1.21.x, 1.22.x, 1.23.x]
2820

2921
steps:
3022
- name: Set up ${{ matrix.go-version }}
@@ -37,3 +29,35 @@ jobs:
3729

3830
- name: Test
3931
run: make test
32+
33+
- name: Upload to Codecov
34+
uses: codecov/codecov-action@v5
35+
with:
36+
files: coverage.txt
37+
token: ${{ secrets.CODECOV_TOKEN }}
38+
39+
test-redis-ce:
40+
name: test-redis-ce
41+
runs-on: ubuntu-latest
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
redis-version:
46+
- "8.0-M03" # 8.0 milestone 4
47+
- "7.4.2" # should use redis stack 7.4
48+
- "7.2.7" # should redis stack 7.2
49+
go-version:
50+
- "1.22.x"
51+
- "1.23.x"
52+
53+
steps:
54+
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
58+
- name: Run tests
59+
uses: ./.github/actions/run-tests
60+
with:
61+
go-version: ${{matrix.go-version}}
62+
redis-version: ${{ matrix.redis-version }}
63+

.github/workflows/doctests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
go-version: [ "1.18", "1.19", "1.20", "1.21" ]
28+
go-version: [ "1.21", "1.22", "1.23" ]
2929

3030
steps:
3131
- name: Set up ${{ matrix.go-version }}

.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.40.0
11+
uses: rojopolis/spellcheck-github-actions@0.47.0
1212
with:
1313
config_path: .github/spellcheck-settings.yml
1414
task_name: Markdown

.github/workflows/test-redis-enterprise.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
go-version: [1.21.x]
18+
go-version: [1.23.x]
1919
re-build: ["7.4.2-54"]
2020

2121
steps:
@@ -46,7 +46,8 @@ jobs:
4646

4747
- name: Test
4848
env:
49-
RE_CLUSTER: "1"
49+
RE_CLUSTER: true
50+
REDIS_MAJOR_VERSION: 7
5051
run: |
5152
go test \
5253
--ginkgo.skip-file="ring_test.go" \

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ testdata/*
33
.idea/
44
.DS_Store
55
*.tar.gz
6-
*.dic
6+
*.dic
7+
redis8tests.sh

.golangci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
run:
2-
concurrency: 8
3-
deadline: 5m
2+
timeout: 5m
43
tests: false

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
2+
export REDIS_MAJOR_VERSION := 7
23

34
test: testdeps
5+
docker start go-redis-redis-stack || docker run -d --name go-redis-redis-stack -p 6379:6379 -e REDIS_ARGS="--enable-debug-command yes --enable-module-command yes" redis/redis-stack-server:latest
46
$(eval GO_VERSION := $(shell go version | cut -d " " -f 3 | cut -d. -f2))
57
set -e; for dir in $(GO_MOD_DIRS); do \
68
if echo "$${dir}" | grep -q "./example" && [ "$(GO_VERSION)" = "19" ]; then \
@@ -14,10 +16,12 @@ test: testdeps
1416
go test ./... -short -race && \
1517
go test ./... -run=NONE -bench=. -benchmem && \
1618
env GOOS=linux GOARCH=386 go test && \
19+
go test -coverprofile=coverage.txt -covermode=atomic ./... && \
1720
go vet); \
1821
done
1922
cd internal/customvet && go build .
2023
go vet -vettool ./internal/customvet/customvet
24+
docker stop go-redis-redis-stack
2125

2226
testdeps: testdata/redis/src/redis-server
2327

@@ -31,7 +35,7 @@ build:
3135

3236
testdata/redis:
3337
mkdir -p $@
34-
wget -qO- https://download.redis.io/releases/redis-7.4-rc2.tar.gz | tar xvz --strip-components=1 -C $@
38+
wget -qO- https://download.redis.io/releases/redis-7.4.2.tar.gz | tar xvz --strip-components=1 -C $@
3539

3640
testdata/redis/src/redis-server: testdata/redis
3741
cd $< && make all

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![build workflow](https://github.com/redis/go-redis/actions/workflows/build.yml/badge.svg)](https://github.com/redis/go-redis/actions)
44
[![PkgGoDev](https://pkg.go.dev/badge/github.com/redis/go-redis/v9)](https://pkg.go.dev/github.com/redis/go-redis/v9?tab=doc)
55
[![Documentation](https://img.shields.io/badge/redis-documentation-informational)](https://redis.uptrace.dev/)
6+
[![codecov](https://codecov.io/github/redis/go-redis/graph/badge.svg?token=tsrCZKuSSw)](https://codecov.io/github/redis/go-redis)
67
[![Chat](https://discordapp.com/api/guilds/752070105847955518/widget.png)](https://discord.gg/rWtp5Aj)
78

89
> go-redis is brought to you by :star: [**uptrace/uptrace**](https://github.com/uptrace/uptrace).
@@ -182,6 +183,24 @@ rdb := redis.NewClient(&redis.Options{
182183
})
183184
```
184185

186+
#### Unstable RESP3 Structures for RediSearch Commands
187+
When integrating Redis with application functionalities using RESP3, it's important to note that some response structures aren't final yet. This is especially true for more complex structures like search and query results. We recommend using RESP2 when using the search and query capabilities, but we plan to stabilize the RESP3-based API-s in the coming versions. You can find more guidance in the upcoming release notes.
188+
189+
To enable unstable RESP3, set the option in your client configuration:
190+
191+
```go
192+
redis.NewClient(&redis.Options{
193+
UnstableResp3: true,
194+
})
195+
```
196+
**Note:** When UnstableResp3 mode is enabled, it's necessary to use RawResult() and RawVal() to retrieve a raw data.
197+
Since, raw response is the only option for unstable search commands Val() and Result() calls wouldn't have any affect on them:
198+
199+
```go
200+
res1, err := client.FTSearchWithArgs(ctx, "txt", "foo bar", &redis.FTSearchOptions{}).RawResult()
201+
val1 := client.FTSearchWithArgs(ctx, "txt", "foo bar", &redis.FTSearchOptions{}).RawVal()
202+
```
203+
185204
## Contributing
186205

187206
Please see [out contributing guidelines](CONTRIBUTING.md) to help us improve this library!

0 commit comments

Comments
 (0)