Skip to content

Commit d02d54e

Browse files
committed
Execute standalone and cluster test simultaneously
1 parent 754a77e commit d02d54e

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ inputs:
44
python-version:
55
description: 'Python version to use for running tests'
66
default: '3.12'
7-
test-type:
8-
description: 'Type of tests to run: standalone or cluster'
9-
required: true
107
parser-backend:
118
description: 'Parser backend to use: plain or hiredis'
129
required: true
@@ -46,28 +43,39 @@ runs:
4643
- name: Run RESP2 tests
4744
run: |
4845
if [ "${{inputs.event-loop}}" == "uvloop" ]; then
49-
invoke ${{inputs.test-type}}-tests --uvloop --protocol=2
46+
invoke standalone-tests --uvloop --protocol=2
47+
invoke cluster-tests --uvloop --protocol=2
5048
else
51-
invoke ${{inputs.test-type}}-tests --protocol=2
49+
invoke standalone-tests --protocol=2
50+
invoke cluster-tests --protocol=2
5251
fi
5352
shell: bash
5453

5554
- name: Run RESP3 tests
56-
if: ${{ inputs.test-type != 'cluster' && inputs.parser-backend != 'hiredis' }}
5755
run: |
5856
if [ "${{inputs.event-loop}}" == "uvloop" ]; then
59-
invoke ${{inputs.test-type}}-tests --uvloop --protocol=3
57+
invoke standalone-tests --uvloop --protocol=3
58+
59+
# hiredis does not support RESP3 on cluster
60+
if [ "${{inputs.parser-backend}}" != 'hiredis' ]; then
61+
invoke cluster-tests --uvloop --protocol=3
62+
fi
6063
else
61-
invoke ${{inputs.test-type}}-tests --protocol=3
64+
invoke standalone-tests --protocol=3
65+
66+
# hiredis does not support RESP3 on cluster
67+
if [ "${{inputs.parser-backend}}" != 'hiredis' ]; then
68+
invoke cluster-tests --uvloop --protocol=3
69+
fi
6270
fi
6371
shell: bash
6472

6573
- name: Upload test results and profiling data
6674
uses: actions/upload-artifact@v4
6775
with:
68-
name: pytest-results-${{inputs.redis-version}}-${{inputs.test-type}}-${{inputs.parser-backend}}-${{inputs.python-version}}-${{inputs.event-loop}}
76+
name: pytest-results-${{inputs.redis-version}}-${{inputs.parser-backend}}-${{inputs.python-version}}-${{inputs.event-loop}}
6977
path: |
70-
${{inputs.test-type}}*-results.xml
78+
*-results.xml
7179
prof/**
7280
profile_output*
7381
if-no-files-found: error

.github/workflows/integration.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@ jobs:
6464
fail-fast: false
6565
matrix:
6666
redis-version: ['8.0.0-M01']
67-
test-type: ['standalone', 'cluster']
6867
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9', 'pypy-3.10']
6968
parser-backend: ['plain']
7069
event-loop: ['asyncio']
7170
env:
7271
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
73-
name: Redis ${{ matrix.redis-version }} (${{matrix.test-type}}); Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
72+
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
7473
steps:
7574
- uses: actions/checkout@v4
7675
- name: Run tests
@@ -90,20 +89,18 @@ jobs:
9089
fail-fast: false
9190
matrix:
9291
redis-version: [ '8.0.0-M01' ]
93-
test-type: [ 'standalone', 'cluster' ]
9492
python-version: [ '3.8', '3.12']
9593
parser-backend: [ 'hiredis' ]
9694
event-loop: [ 'asyncio' ]
9795
env:
9896
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
99-
name: Redis ${{ matrix.redis-version }} (${{matrix.test-type}}); Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
97+
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
10098
steps:
10199
- uses: actions/checkout@v4
102100
- name: Run tests
103101
uses: ./.github/actions/run-tests
104102
with:
105103
python-version: ${{ matrix.python-version }}
106-
test-type: ${{ matrix.test-type }}
107104
parser-backend: ${{ matrix.parser-backend }}
108105
redis-version: ${{ matrix.redis-version }}
109106

@@ -112,7 +109,6 @@ jobs:
112109
if: ${{ matrix.parser-backend == 'hiredis' && matrix.python-version == '3.12'}}
113110
with:
114111
python-version: ${{ matrix.python-version }}
115-
test-type: ${{ matrix.test-type }}
116112
parser-backend: ${{ matrix.parser-backend }}
117113
redis-version: ${{ matrix.redis-version }}
118114
hiredis-version: '<3.0.0'
@@ -132,14 +128,13 @@ jobs:
132128
event-loop: [ 'uvloop' ]
133129
env:
134130
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
135-
name: Redis ${{ matrix.redis-version }} (${{matrix.test-type}}); Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
131+
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
136132
steps:
137133
- uses: actions/checkout@v4
138134
- name: Run tests
139135
uses: ./.github/actions/run-tests
140136
with:
141137
python-version: ${{ matrix.python-version }}
142-
test-type: ${{ matrix.test-type }}
143138
parser-backend: ${{ matrix.parser-backend }}
144139
redis-version: ${{ matrix.redis-version }}
145140

tasks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111

1212
@task
13-
def devenv(c):
13+
def devenv(c, endpoints="all"):
1414
"""Brings up the test environment, by wrapping docker compose."""
1515
clean(c)
16-
cmd = "docker compose --profile all up -d --build"
16+
cmd = f"docker compose --profile {endpoints} up -d --build"
1717
run(cmd)
1818

1919

@@ -55,11 +55,11 @@ def standalone_tests(c, uvloop=False, protocol=2, profile=False):
5555
profile_arg = "--profile" if profile else ""
5656
if uvloop:
5757
run(
58-
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -m 'not onlycluster' --uvloop --junit-xml=standalone-uvloop-results.xml"
58+
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_resp{protocol}_uvloop.xml -m 'not onlycluster' --uvloop --junit-xml=standalone-resp{protocol}-uvloop-results.xml"
5959
)
6060
else:
6161
run(
62-
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_redis.xml -m 'not onlycluster' --junit-xml=standalone-results.xml"
62+
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_resp{protocol}.xml -m 'not onlycluster' --junit-xml=standalone-resp{protocol}-results.xml"
6363
)
6464

6565

@@ -71,11 +71,11 @@ def cluster_tests(c, uvloop=False, protocol=2, profile=False):
7171
cluster_tls_url = "rediss://localhost:17379/0"
7272
if uvloop:
7373
run(
74-
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_cluster.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --redis-ssl-url={cluster_tls_url} --junit-xml=cluster-uvloop-results.xml --uvloop"
74+
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_cluster_resp{protocol}_uvloop.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --redis-ssl-url={cluster_tls_url} --junit-xml=cluster-resp{protocol}-uvloop-results.xml --uvloop"
7575
)
7676
else:
7777
run(
78-
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_clusteclient.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --redis-ssl-url={cluster_tls_url} --junit-xml=cluster-results.xml"
78+
f"pytest {profile_arg} --protocol={protocol} --cov=./ --cov-report=xml:coverage_cluster_resp{protocol}.xml -m 'not onlynoncluster and not redismod' --redis-url={cluster_url} --redis-ssl-url={cluster_tls_url} --junit-xml=cluster-resp{protocol}-results.xml"
7979
)
8080

8181

0 commit comments

Comments
 (0)