Skip to content

Commit 46740c8

Browse files
committed
Replacing the redis and redis-stack-server images with redis-libs-tests image in test infrastructure (#3505)
* Replacing the redis image with redis-libs-tests image in test infrastructure * Replacing redis-stack-server image usage with client-libs-test. Fixing lib version in setup.py * Defining stack tag variable for the build and test github action * Removing unused env var from build and test github actions
1 parent 1c0a6f2 commit 46740c8

File tree

4 files changed

+61
-69
lines changed

4 files changed

+61
-69
lines changed

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

+24-25
Original file line numberDiff line numberDiff line change
@@ -31,92 +31,91 @@ runs:
3131
- name: Setup Test environment
3232
env:
3333
REDIS_VERSION: ${{ inputs.redis-version }}
34-
REDIS_IMAGE: "redis:${{ inputs.redis-version }}"
35-
CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ inputs.redis-version }}"
34+
CLIENT_LIBS_TEST_IMAGE_TAG: ${{ inputs.redis-version }}
3635
run: |
3736
set -e
38-
37+
3938
echo "::group::Installing dependencies"
4039
pip install -U setuptools wheel
4140
pip install -r requirements.txt
4241
pip install -r dev_requirements.txt
4342
if [ "${{inputs.parser-backend}}" == "hiredis" ]; then
4443
pip install "hiredis${{inputs.hiredis-version}}"
45-
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
44+
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
4645
else
4746
echo "PARSER_BACKEND=${{inputs.parser-backend}}" >> $GITHUB_ENV
4847
fi
4948
echo "::endgroup::"
50-
49+
5150
echo "::group::Starting Redis servers"
5251
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
53-
52+
5453
if (( redis_major_version < 8 )); then
5554
echo "Using redis-stack for module tests"
56-
57-
# Mapping of redis version to stack version
55+
56+
# Mapping of redis version to stack version
5857
declare -A redis_stack_version_mapping=(
59-
["7.4.2"]="7.4.0-v3"
60-
["7.2.7"]="7.2.0-v15"
61-
["6.2.17"]="6.2.6-v19"
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"
6261
)
63-
62+
6463
if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
65-
export REDIS_STACK_IMAGE="redis/redis-stack-server:${redis_stack_version_mapping[$REDIS_VERSION]}"
64+
export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=${redis_stack_version_mapping[$REDIS_VERSION]}
6665
echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV
6766
else
6867
echo "Version not found in the mapping."
6968
exit 1
7069
fi
71-
70+
7271
if (( redis_major_version < 7 )); then
7372
export REDIS_STACK_EXTRA_ARGS="--tls-auth-clients optional --save ''"
7473
export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
7574
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
7675
fi
77-
76+
7877
invoke devenv --endpoints=all-stack
7978
else
8079
echo "Using redis CE for module tests"
8180
echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
8281
invoke devenv --endpoints all
83-
fi
84-
82+
fi
83+
8584
sleep 10 # time to settle
8685
echo "::endgroup::"
8786
shell: bash
8887

8988
- name: Run tests
9089
run: |
9190
set -e
92-
91+
9392
run_tests() {
9493
local protocol=$1
9594
local eventloop=""
96-
95+
9796
if [ "${{inputs.event-loop}}" == "uvloop" ]; then
9897
eventloop="--uvloop"
9998
fi
100-
99+
101100
echo "::group::RESP${protocol} standalone tests"
102101
echo "REDIS_MOD_URL=${REDIS_MOD_URL}"
103-
102+
104103
if (( $REDIS_MAJOR_VERSION < 7 )) && [ "$protocol" == "3" ]; then
105104
echo "Skipping module tests: Modules doesn't support RESP3 for Redis versions < 7"
106105
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}" --extra-markers="not redismod and not cp_integration"
107-
else
106+
else
108107
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}"
109108
fi
110-
109+
111110
echo "::endgroup::"
112-
111+
113112
if [ "$protocol" == "2" ] || [ "${{inputs.parser-backend}}" != 'hiredis' ]; then
114113
echo "::group::RESP${protocol} cluster tests"
115114
invoke cluster-tests $eventloop --protocol=${protocol}
116115
echo "::endgroup::"
117116
fi
118117
}
119-
118+
120119
run_tests 2 "${{inputs.event-loop}}"
121120
run_tests 3 "${{inputs.event-loop}}"
122121
shell: bash

.github/workflows/integration.yaml

+3-5
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ env:
2727
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2828
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
2929
COVERAGE_CORE: sysmon
30-
REDIS_IMAGE: redis:latest
31-
REDIS_STACK_IMAGE: redis/redis-stack-server:latest
30+
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: 'rs-7.4.0-v2'
3231
CURRENT_REDIS_VERSION: '7.4.2'
3332

3433
jobs:
@@ -180,9 +179,8 @@ jobs:
180179
python-version: 3.9
181180
- name: Run installed unit tests
182181
env:
183-
REDIS_VERSION: ${{ env.CURRENT_REDIS_VERSION }}
184-
REDIS_IMAGE: "redis:${{ env.CURRENT_REDIS_VERSION }}"
185-
CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ env.CURRENT_REDIS_VERSION }}"
182+
CLIENT_LIBS_TEST_IMAGE_TAG: ${{ env.CURRENT_REDIS_VERSION }}
183+
CLIENT_LIBS_TEST_STACK_IMAGE_TAG: ${{ env.CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG }}
186184
run: |
187185
bash .github/workflows/install_and_test.sh ${{ matrix.extension }}
188186

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ docker/stunnel/keys
2323
/dockers/*/tls/*
2424
/dockers/standalone/
2525
/dockers/cluster/
26+
/dockers/replica/
27+
/dockers/sentinel/
28+
/dockers/redis-stack/

docker-compose.yml

+31-39
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
---
2+
x-client-libs-stack-image: &client-libs-stack-image
3+
image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_STACK_IMAGE_TAG:-rs-7.4.0-v2}"
4+
5+
x-client-libs-image: &client-libs-image
6+
image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_IMAGE_TAG:-7.4.2}"
27

38
services:
49

510
redis:
6-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:7.4.1}
11+
<<: *client-libs-image
712
container_name: redis-standalone
813
environment:
914
- TLS_ENABLED=yes
@@ -24,20 +29,26 @@ services:
2429
- all
2530

2631
replica:
27-
image: ${REDIS_IMAGE:-redis:7.4.1}
32+
<<: *client-libs-image
2833
container_name: redis-replica
2934
depends_on:
3035
- redis
31-
command: redis-server --replicaof redis 6379 --protected-mode no --save ""
36+
environment:
37+
- TLS_ENABLED=no
38+
- REDIS_CLUSTER=no
39+
- PORT=6380
40+
command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --replicaof redis 6379 --protected-mode no --save ""}
3241
ports:
33-
- 6380:6379
42+
- 6380:6380
43+
volumes:
44+
- "./dockers/replica:/redis/work"
3445
profiles:
3546
- replica
3647
- all-stack
3748
- all
3849

3950
cluster:
40-
image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:7.4.1}
51+
<<: *client-libs-image
4152
container_name: redis-cluster
4253
environment:
4354
- REDIS_CLUSTER=yes
@@ -58,57 +69,38 @@ services:
5869
- all
5970

6071
sentinel:
61-
image: ${REDIS_IMAGE:-redis:7.4.1}
72+
<<: *client-libs-image
6273
container_name: redis-sentinel
6374
depends_on:
6475
- redis
65-
entrypoint: "redis-sentinel /redis.conf --port 26379"
76+
environment:
77+
- REDIS_CLUSTER=no
78+
- NODES=3
79+
- PORT=26379
80+
command: ${REDIS_EXTRA_ARGS:---sentinel}
6681
ports:
6782
- 26379:26379
68-
volumes:
69-
- "./dockers/sentinel.conf:/redis.conf"
70-
profiles:
71-
- sentinel
72-
- all-stack
73-
- all
74-
75-
sentinel2:
76-
image: ${REDIS_IMAGE:-redis:7.4.1}
77-
container_name: redis-sentinel2
78-
depends_on:
79-
- redis
80-
entrypoint: "redis-sentinel /redis.conf --port 26380"
81-
ports:
8283
- 26380:26380
83-
volumes:
84-
- "./dockers/sentinel.conf:/redis.conf"
85-
profiles:
86-
- sentinel
87-
- all-stack
88-
- all
89-
90-
sentinel3:
91-
image: ${REDIS_IMAGE:-redis:7.4.1}
92-
container_name: redis-sentinel3
93-
depends_on:
94-
- redis
95-
entrypoint: "redis-sentinel /redis.conf --port 26381"
96-
ports:
9784
- 26381:26381
9885
volumes:
99-
- "./dockers/sentinel.conf:/redis.conf"
86+
- "./dockers/sentinel.conf:/redis/config-default/redis.conf"
87+
- "./dockers/sentinel:/redis/work"
10088
profiles:
10189
- sentinel
10290
- all-stack
10391
- all
10492

10593
redis-stack:
106-
image: ${REDIS_STACK_IMAGE:-redis/redis-stack-server:latest}
94+
<<: *client-libs-stack-image
10795
container_name: redis-stack
96+
environment:
97+
- REDIS_CLUSTER=no
98+
- PORT=6379
99+
command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --save ""}
108100
ports:
109101
- 6479:6379
110-
environment:
111-
- "REDIS_ARGS=${REDIS_STACK_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --save ''}"
102+
volumes:
103+
- "./dockers/redis-stack:/redis/work"
112104
profiles:
113105
- standalone
114106
- all-stack

0 commit comments

Comments
 (0)