Skip to content

Commit 8aba380

Browse files
chayimdvora-h
andauthored
Adding RESP3 tests support (#2793)
* start cleaning * clean sone callbacks * first phase * tox wrap back * changing cancel format * syntax * lint * docker * contain the docker * tox dev reqs * back to testing * response callbacks * protocol into async conftest * fix for 3.11 invoke * docker changes * fix tests * linters * adding * resp3 tox, until killed * remove tox * tests * requirements.txt * restoring requirements.txt * adding a sleep, hopefully enough time for the cluster dockers to settle * fix search tests * search test, disable uvloop for pypy due to bug * syn * reg * dialect test improvement * sleep+, xfail * tests * resp * flaky search test too * timing * timing for async test * test changes * fix assert_interval_advanced * revert * mark async health_check tests with xfail * change strict to false * fix github actions package validation --------- Co-authored-by: dvora-h <[email protected]>
1 parent adc5116 commit 8aba380

File tree

111 files changed

+1963
-2384
lines changed

Some content is hidden

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

111 files changed

+1963
-2384
lines changed

.flake8

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[flake8]
2+
max-line-length = 88
3+
exclude =
4+
*.egg-info,
5+
*.pyc,
6+
.git,
7+
.tox,
8+
.venv*,
9+
build,
10+
docs/*,
11+
dist,
12+
docker,
13+
venv*,
14+
.venv*,
15+
whitelist.py,
16+
tasks.py
17+
ignore =
18+
F405
19+
W503
20+
E203
21+
E126

.github/workflows/integration.yaml

+62-13
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
schedule:
1717
- cron: '0 1 * * *' # nightly build
1818

19+
concurrency:
20+
group: ${{ github.event.pull_request.number || github.ref }}
21+
cancel-in-progress: true
22+
1923
permissions:
2024
contents: read # to fetch code (actions/checkout)
2125

@@ -48,7 +52,7 @@ jobs:
4852
4953
run-tests:
5054
runs-on: ubuntu-latest
51-
timeout-minutes: 30
55+
timeout-minutes: 60
5256
strategy:
5357
max-parallel: 15
5458
fail-fast: false
@@ -68,32 +72,77 @@ jobs:
6872
- name: run tests
6973
run: |
7074
pip install -U setuptools wheel
75+
pip install -r requirements.txt
7176
pip install -r dev_requirements.txt
72-
tox -e ${{matrix.test-type}}-${{matrix.connection-type}}
77+
if [ "${{matrix.connection-type}}" == "hiredis" ]; then
78+
pip install hiredis
79+
fi
80+
invoke devenv
81+
sleep 5 # time to settle
82+
invoke ${{matrix.test-type}}-tests
83+
7384
- uses: actions/upload-artifact@v2
7485
if: success() || failure()
7586
with:
76-
name: pytest-results-${{matrix.test-type}}
87+
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}
7788
path: '${{matrix.test-type}}*results.xml'
89+
7890
- name: Upload codecov coverage
7991
uses: codecov/codecov-action@v3
92+
if: ${{matrix.python-version == '3.11'}}
8093
with:
8194
fail_ci_if_error: false
82-
# - name: View Test Results
83-
# uses: dorny/test-reporter@v1
84-
# if: success() || failure()
85-
# with:
86-
# name: Test Results ${{matrix.python-version}} ${{matrix.test-type}}-${{matrix.connection-type}}
87-
# path: '${{matrix.test-type}}*results.xml'
88-
# reporter: java-junit
89-
# list-suites: failed
90-
# list-tests: failed
91-
# max-annotations: 10
95+
96+
- name: View Test Results
97+
uses: dorny/test-reporter@v1
98+
if: success() || failure()
99+
continue-on-error: true
100+
with:
101+
name: Test Results ${{matrix.python-version}} ${{matrix.test-type}}-${{matrix.connection-type}}
102+
path: '*.xml'
103+
reporter: java-junit
104+
list-suites: all
105+
list-tests: all
106+
max-annotations: 10
107+
fail-on-error: 'false'
108+
109+
resp3_tests:
110+
runs-on: ubuntu-latest
111+
strategy:
112+
fail-fast: false
113+
matrix:
114+
python-version: ['3.7', '3.11']
115+
test-type: ['standalone', 'cluster']
116+
connection-type: ['hiredis', 'plain']
117+
protocol: ['3']
118+
env:
119+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
120+
name: RESP3 [${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}]
121+
steps:
122+
- uses: actions/checkout@v3
123+
- uses: actions/setup-python@v4
124+
with:
125+
python-version: ${{ matrix.python-version }}
126+
cache: 'pip'
127+
- name: run tests
128+
run: |
129+
pip install -U setuptools wheel
130+
pip install -r requirements.txt
131+
pip install -r dev_requirements.txt
132+
if [ "${{matrix.connection-type}}" == "hiredis" ]; then
133+
pip install hiredis
134+
fi
135+
invoke devenv
136+
sleep 5 # time to settle
137+
invoke ${{matrix.test-type}}-tests
138+
invoke ${{matrix.test-type}}-tests --uvloop
92139
93140
build_and_test_package:
94141
name: Validate building and installing the package
95142
runs-on: ubuntu-latest
143+
needs: [run-tests]
96144
strategy:
145+
fail-fast: false
97146
matrix:
98147
extension: ['tar.gz', 'whl']
99148
steps:

.isort.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[settings]
2+
profile=black
3+
multi_line_output=3
4+
src_paths = ["redis", "tests"]
5+
skip_glob=benchmarks/*

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ Here's how to get started with your code contribution:
3838
a. python -m venv .venv
3939
b. source .venv/bin/activate
4040
c. pip install -r dev_requirements.txt
41+
c. pip install -r requirements.txt
4142

42-
4. If you need a development environment, run `invoke devenv`
43+
4. If you need a development environment, run `invoke devenv`. Note: this relies on docker-compose to build environments, and assumes that you have a version supporting [docker profiles](https://docs.docker.com/compose/profiles/).
4344
5. While developing, make sure the tests pass by running `invoke tests`
4445
6. If you like the change and think the project could use it, send a
4546
pull request
@@ -59,7 +60,6 @@ can execute docker and its various commands.
5960
- Three sentinel Redis nodes
6061
- A redis cluster
6162
- An stunnel docker, fronting the master Redis node
62-
- A Redis node, running unstable - the latest redis
6363

6464
The replica node, is a replica of the master node, using the
6565
[leader-follower replication](https://redis.io/topics/replication)

dev_requirements.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
click==8.0.4
22
black==22.3.0
33
flake8==5.0.4
4+
flake8-isort==6.0.0
45
flynt~=0.69.0
5-
isort==5.10.1
66
mock==4.0.3
77
packaging>=20.4
88
pytest==7.2.0
9-
pytest-timeout==2.0.1
9+
pytest-timeout==2.1.0
1010
pytest-asyncio>=0.20.2
1111
tox==3.27.1
12-
tox-docker==3.1.0
1312
invoke==1.7.3
1413
pytest-cov>=4.0.0
1514
vulture>=2.3.0

docker-compose.yml

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
3+
version: "3.8"
4+
5+
services:
6+
7+
redis:
8+
image: redis/redis-stack-server:edge
9+
container_name: redis-standalone
10+
ports:
11+
- 6379:6379
12+
environment:
13+
- "REDIS_ARGS=--enable-debug-command yes --enable-module-command yes"
14+
profiles:
15+
- standalone
16+
- sentinel
17+
- replica
18+
- all
19+
20+
replica:
21+
image: redis/redis-stack-server:edge
22+
container_name: redis-replica
23+
depends_on:
24+
- redis
25+
environment:
26+
- "REDIS_ARGS=--replicaof redis 6379"
27+
ports:
28+
- 6380:6379
29+
profiles:
30+
- replica
31+
- all
32+
33+
cluster:
34+
container_name: redis-cluster
35+
build:
36+
context: .
37+
dockerfile: dockers/Dockerfile.cluster
38+
ports:
39+
- 16379:16379
40+
- 16380:16380
41+
- 16381:16381
42+
- 16382:16382
43+
- 16383:16383
44+
- 16384:16384
45+
volumes:
46+
- "./dockers/cluster.redis.conf:/redis.conf:ro"
47+
profiles:
48+
- cluster
49+
- all
50+
51+
stunnel:
52+
image: redisfab/stunnel:latest
53+
depends_on:
54+
- redis
55+
ports:
56+
- 6666:6666
57+
profiles:
58+
- all
59+
- standalone
60+
- ssl
61+
volumes:
62+
- "./dockers/stunnel/conf:/etc/stunnel/conf.d:ro"
63+
- "./dockers/stunnel/keys:/etc/stunnel/keys:ro"
64+
65+
sentinel:
66+
image: redis/redis-stack-server:edge
67+
container_name: redis-sentinel
68+
depends_on:
69+
- redis
70+
environment:
71+
- "REDIS_ARGS=--port 26379"
72+
entrypoint: "/opt/redis-stack/bin/redis-sentinel /redis.conf --port 26379"
73+
ports:
74+
- 26379:26379
75+
volumes:
76+
- "./dockers/sentinel.conf:/redis.conf"
77+
profiles:
78+
- sentinel
79+
- all
80+
81+
sentinel2:
82+
image: redis/redis-stack-server:edge
83+
container_name: redis-sentinel2
84+
depends_on:
85+
- redis
86+
environment:
87+
- "REDIS_ARGS=--port 26380"
88+
entrypoint: "/opt/redis-stack/bin/redis-sentinel /redis.conf --port 26380"
89+
ports:
90+
- 26380:26380
91+
volumes:
92+
- "./dockers/sentinel.conf:/redis.conf"
93+
profiles:
94+
- sentinel
95+
- all
96+
97+
sentinel3:
98+
image: redis/redis-stack-server:edge
99+
container_name: redis-sentinel3
100+
depends_on:
101+
- redis
102+
entrypoint: "/opt/redis-stack/bin/redis-sentinel /redis.conf --port 26381"
103+
ports:
104+
- 26381:26381
105+
volumes:
106+
- "./dockers/sentinel.conf:/redis.conf"
107+
profiles:
108+
- sentinel
109+
- all

docker/base/Dockerfile

-4
This file was deleted.

docker/base/Dockerfile.cluster

-11
This file was deleted.

docker/base/Dockerfile.cluster4

-9
This file was deleted.

docker/base/Dockerfile.cluster5

-9
This file was deleted.

docker/base/Dockerfile.redis4

-4
This file was deleted.

docker/base/Dockerfile.redis5

-4
This file was deleted.

docker/base/Dockerfile.redismod_cluster

-12
This file was deleted.

docker/base/Dockerfile.sentinel

-4
This file was deleted.

docker/base/Dockerfile.sentinel4

-4
This file was deleted.

docker/base/Dockerfile.sentinel5

-4
This file was deleted.

docker/base/Dockerfile.stunnel

-11
This file was deleted.

docker/base/Dockerfile.unstable

-18
This file was deleted.

0 commit comments

Comments
 (0)