Skip to content

Commit f9d8d6e

Browse files
authored
Merge branch 'master' into fix/3014-stacktrace-del-redis-client-on-exit
2 parents ae5b957 + ea01a30 commit f9d8d6e

File tree

150 files changed

+6534
-4563
lines changed

Some content is hidden

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

150 files changed

+6534
-4563
lines changed

.flake8

Lines changed: 0 additions & 28 deletions
This file was deleted.

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

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: 'Run redis-py tests'
2+
description: 'Runs redis-py tests against different Redis versions and configurations'
3+
inputs:
4+
python-version:
5+
description: 'Python version to use for running tests'
6+
default: '3.12'
7+
parser-backend:
8+
description: 'Parser backend to use: plain or hiredis'
9+
required: true
10+
redis-version:
11+
description: 'Redis version to test against'
12+
required: true
13+
hiredis-version:
14+
description: 'hiredis version to test against'
15+
required: false
16+
default: '>3.0.0'
17+
event-loop:
18+
description: 'Event loop to use'
19+
required: false
20+
default: 'asyncio'
21+
runs:
22+
using: "composite"
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ inputs.python-version }}
29+
cache: 'pip'
30+
31+
- name: Setup Test environment
32+
env:
33+
REDIS_VERSION: ${{ inputs.redis-version }}
34+
CLIENT_LIBS_TEST_IMAGE_TAG: ${{ inputs.redis-version }}
35+
run: |
36+
set -e
37+
38+
echo "::group::Installing dependencies"
39+
pip install -r dev_requirements.txt
40+
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
41+
pip install -e .[jwt] # install the working copy
42+
if [ "${{inputs.parser-backend}}" == "hiredis" ]; then
43+
pip install "hiredis${{inputs.hiredis-version}}"
44+
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
45+
else
46+
echo "PARSER_BACKEND=${{inputs.parser-backend}}" >> $GITHUB_ENV
47+
fi
48+
echo "::endgroup::"
49+
50+
echo "::group::Starting Redis servers"
51+
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
52+
53+
if (( redis_major_version < 8 )); then
54+
echo "Using redis-stack for module tests"
55+
56+
# Mapping of redis version to stack version
57+
declare -A redis_stack_version_mapping=(
58+
["7.4.2"]="rs-7.4.0-v2"
59+
["7.2.7"]="rs-7.2.0-v14"
60+
["6.2.17"]="rs-6.2.6-v18"
61+
)
62+
63+
if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
64+
export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=${redis_stack_version_mapping[$REDIS_VERSION]}
65+
echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV
66+
else
67+
echo "Version not found in the mapping."
68+
exit 1
69+
fi
70+
71+
if (( redis_major_version < 7 )); then
72+
export REDIS_STACK_EXTRA_ARGS="--tls-auth-clients optional --save ''"
73+
export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
74+
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
75+
fi
76+
77+
invoke devenv --endpoints=all-stack
78+
else
79+
echo "Using redis CE for module tests"
80+
echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
81+
invoke devenv --endpoints all
82+
fi
83+
84+
sleep 10 # time to settle
85+
echo "::endgroup::"
86+
shell: bash
87+
88+
- name: Run tests
89+
run: |
90+
set -e
91+
92+
run_tests() {
93+
local protocol=$1
94+
local eventloop=""
95+
96+
if [ "${{inputs.event-loop}}" == "uvloop" ]; then
97+
eventloop="--uvloop"
98+
fi
99+
100+
echo "::group::RESP${protocol} standalone tests"
101+
echo "REDIS_MOD_URL=${REDIS_MOD_URL}"
102+
103+
if (( $REDIS_MAJOR_VERSION < 7 )) && [ "$protocol" == "3" ]; then
104+
echo "Skipping module tests: Modules doesn't support RESP3 for Redis versions < 7"
105+
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}" --extra-markers="not redismod and not cp_integration"
106+
else
107+
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}"
108+
fi
109+
110+
echo "::endgroup::"
111+
112+
if [ "$protocol" == "2" ] || [ "${{inputs.parser-backend}}" != 'hiredis' ]; then
113+
echo "::group::RESP${protocol} cluster tests"
114+
invoke cluster-tests $eventloop --protocol=${protocol}
115+
echo "::endgroup::"
116+
fi
117+
}
118+
119+
run_tests 2 "${{inputs.event-loop}}"
120+
run_tests 3 "${{inputs.event-loop}}"
121+
shell: bash
122+
123+
- name: Debug
124+
if: failure()
125+
run: |
126+
sudo apt-get install -y redis-tools
127+
echo "Docker Containers:"
128+
docker ps
129+
redis-cli -p 16379 CLUSTER NODES
130+
shell: bash
131+
132+
- name: Upload test results and profiling data
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: pytest-results-redis_${{inputs.redis-version}}-python_${{inputs.python-version}}-parser_${{env.PARSER_BACKEND}}-el_${{inputs.event-loop}}
136+
path: |
137+
*-results.xml
138+
prof/**
139+
profile_output*
140+
if-no-files-found: error
141+
retention-days: 10
142+
143+
- name: Upload codecov coverage
144+
uses: codecov/codecov-action@v4
145+
with:
146+
fail_ci_if_error: false

.github/wordlist.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ ConnectionPool
1212
CoreCommands
1313
EVAL
1414
EVALSHA
15-
GraphCommands
1615
Grokzen's
1716
INCR
1817
IOError
@@ -39,7 +38,6 @@ RedisCluster
3938
RedisClusterCommands
4039
RedisClusterException
4140
RedisClusters
42-
RedisGraph
4341
RedisInstrumentor
4442
RedisJSON
4543
RedisTimeSeries

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
sudo apt-get install -yqq pandoc make
3737
- name: run code linters
3838
run: |
39-
pip install -r requirements.txt -r dev_requirements.txt -r docs/requirements.txt
39+
pip install -r dev_requirements.txt -r docs/requirements.txt
4040
invoke build-docs
4141
4242
- name: upload docs

.github/workflows/install_and_test.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ python -m venv ${DESTENV}
2121
source ${DESTENV}/bin/activate
2222
pip install --upgrade --quiet pip
2323
pip install --quiet -r dev_requirements.txt
24-
invoke devenv
24+
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
25+
invoke devenv --endpoints=all-stack
2526
invoke package
2627

2728
# find packages
@@ -42,4 +43,6 @@ pip install ${PKG}
4243
pytest -m 'not onlycluster'
4344
# RedisCluster tests
4445
CLUSTER_URL="redis://localhost:16379/0"
45-
pytest -m 'not onlynoncluster and not redismod and not ssl' --redis-url=${CLUSTER_URL}
46+
CLUSTER_SSL_URL="rediss://localhost:27379/0"
47+
pytest -m 'not onlynoncluster and not redismod and not ssl' \
48+
--redis-url="${CLUSTER_URL}" --redis-ssl-url="${CLUSTER_SSL_URL}"

0 commit comments

Comments
 (0)