Skip to content

Migrate to clients test image #3415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9c3b198
Migrate to client-testing image
uglide Oct 15, 2024
a0c09d7
Fix migration bugs
uglide Oct 15, 2024
bcc489a
Create reusable action to run tests
uglide Oct 16, 2024
1b7bca6
Reorg test matrix
uglide Oct 16, 2024
639b167
Fix jobs names and execution order
uglide Oct 16, 2024
34cd679
Execute standalone and cluster test simultaneously
uglide Oct 16, 2024
46b83ed
Streamline test execution
uglide Oct 16, 2024
3379ab3
More fixes to integration job
uglide Oct 16, 2024
7dcb2f6
Move python compatibility tests to a separate task
uglide Oct 17, 2024
b98850c
Improve run-tests action
uglide Oct 17, 2024
4881c1b
Add missing pytest marks for TS tests
uglide Oct 17, 2024
8ed1c16
Fix cluster configuration
uglide Oct 17, 2024
d0e12a3
Debug cluster tests
uglide Oct 17, 2024
f15b0f0
Fix Cluster TLS port
uglide Oct 17, 2024
dd3f650
Move current redis version to env var
uglide Oct 18, 2024
d6792b5
Fix ssl tests
uglide Oct 18, 2024
b682e11
Show CLUSTER NODES on fail
uglide Oct 18, 2024
1768d0a
Fix integration workflow bugs
uglide Oct 18, 2024
f469f26
Add workarounds for IPv6 bug in tests
uglide Oct 22, 2024
83ceb68
Use hostname instead of hardcoded IPv4 loopback
uglide Oct 22, 2024
0daf73b
Fix bug in _get_client
uglide Oct 22, 2024
6b79e78
Fix run-tests action
uglide Oct 23, 2024
8f91c57
Fix imports
uglide Oct 23, 2024
75cf787
Add missing version guards in search tests
uglide Oct 23, 2024
0ea5dfc
Add compatibility for Redis < 7
uglide Oct 23, 2024
da974b2
Add missing version guard in search tests
uglide Oct 23, 2024
b85e69d
Fix run-tests
uglide Oct 23, 2024
1e757be
Add missing tls-auth-clients option
uglide Oct 23, 2024
6f63bd6
Skip module tests when Redis < 7 and RESP3 is enabled
uglide Oct 23, 2024
61677eb
Fix async test_moved_redirection_on_slave_with_default
uglide Oct 24, 2024
fbabc6d
Cleanup test after debugging
uglide Oct 24, 2024
3f2926c
Use correct profile in install_and_test.sh
uglide Oct 24, 2024
fb50dbd
Use matrix to execute hiredis<=3.0.0 tests
uglide Oct 24, 2024
46cfc93
Fix hiredis job
uglide Oct 24, 2024
077a525
Fix pytest command in install_and_test.sh
uglide Oct 24, 2024
1638bbb
Use 7.4.1 as default version in docker-compose.yml
uglide Oct 24, 2024
f04991d
Fix uvloop-tests
uglide Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: 'Run redis-py tests'
description: 'Runs redis-py tests against different Redis versions and configurations'
inputs:
python-version:
description: 'Python version to use for running tests'
default: '3.12'
parser-backend:
description: 'Parser backend to use: plain or hiredis'
required: true
redis-version:
description: 'Redis version to test against'
required: true
hiredis-version:
description: 'hiredis version to test against'
required: false
default: '>3.0.0'
event-loop:
description: 'Event loop to use'
required: false
default: 'asyncio'
runs:
using: "composite"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'

- name: Setup Test environment
env:
REDIS_VERSION: ${{ inputs.redis-version }}
REDIS_IMAGE: "redis:${{ inputs.redis-version }}"
CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ inputs.redis-version }}"
run: |
set -e

echo "::group::Installing dependencies"
pip install -U setuptools wheel
pip install -r requirements.txt
pip install -r dev_requirements.txt
if [ "${{inputs.parser-backend}}" == "hiredis" ]; then
pip install "hiredis${{inputs.hiredis-version}}"
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
else
echo "PARSER_BACKEND=${{inputs.parser-backend}}" >> $GITHUB_ENV
fi
echo "::endgroup::"

echo "::group::Starting Redis servers"
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')

if (( redis_major_version < 8 )); then
echo "Using redis-stack for module tests"

# Mapping of redis version to stack version
declare -A redis_stack_version_mapping=(
["7.4.1"]="7.4.0-v1"
["7.2.6"]="7.2.0-v13"
["6.2.16"]="6.2.6-v17"
)

if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
export REDIS_STACK_IMAGE="redis/redis-stack-server:${redis_stack_version_mapping[$REDIS_VERSION]}"
echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV
else
echo "Version not found in the mapping."
exit 1
fi

if (( redis_major_version < 7 )); then
export REDIS_STACK_EXTRA_ARGS="--tls-auth-clients optional --save ''"
export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
fi

invoke devenv --endpoints=all-stack
else
echo "Using redis CE for module tests"
echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
invoke devenv --endpoints all
fi

sleep 10 # time to settle
echo "::endgroup::"
shell: bash

- name: Run tests
run: |
set -e

run_tests() {
local protocol=$1
local eventloop=""

if [ "${{inputs.event-loop}}" == "uvloop" ]; then
eventloop="--uvloop"
fi

echo "::group::RESP${protocol} standalone tests"
echo "REDIS_MOD_URL=${REDIS_MOD_URL}"

if (( $REDIS_MAJOR_VERSION < 7 )) && [ "$protocol" == "3" ]; then
echo "Skipping module tests: Modules doesn't support RESP3 for Redis versions < 7"
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}" --extra-markers="not redismod"
else
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}"
fi

echo "::endgroup::"

if [ "$protocol" == "2" ] || [ "${{inputs.parser-backend}}" != 'hiredis' ]; then
echo "::group::RESP${protocol} cluster tests"
invoke cluster-tests $eventloop --protocol=${protocol}
echo "::endgroup::"
fi
}

run_tests 2 "${{inputs.event-loop}}"
run_tests 3 "${{inputs.event-loop}}"
shell: bash

- name: Debug
if: failure()
run: |
sudo apt-get install -y redis-tools
echo "Docker Containers:"
docker ps
redis-cli -p 16379 CLUSTER NODES
shell: bash

- name: Upload test results and profiling data
uses: actions/upload-artifact@v4
with:
name: pytest-results-redis_${{inputs.redis-version}}-python_${{inputs.python-version}}-parser_${{env.PARSER_BACKEND}}-el_${{inputs.event-loop}}
path: |
*-results.xml
prof/**
profile_output*
if-no-files-found: error
retention-days: 10

- name: Upload codecov coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
8 changes: 5 additions & 3 deletions .github/workflows/install_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ python -m venv ${DESTENV}
source ${DESTENV}/bin/activate
pip install --upgrade --quiet pip
pip install --quiet -r dev_requirements.txt
invoke devenv
invoke devenv --endpoints=all-stack
invoke package

# find packages
Expand All @@ -39,7 +39,9 @@ cd ${TESTDIR}
# install, run tests
pip install ${PKG}
# Redis tests
pytest -m 'not onlycluster'
pytest -m 'not onlycluster and not graph'
# RedisCluster tests
CLUSTER_URL="redis://localhost:16379/0"
pytest -m 'not onlynoncluster and not redismod and not ssl' --redis-url=${CLUSTER_URL}
CLUSTER_SSL_URL="rediss://localhost:27379/0"
pytest -m 'not onlynoncluster and not redismod and not ssl and not graph' \
--redis-url="${CLUSTER_URL}" --redis-ssl-url="${CLUSTER_SSL_URL}"
Loading
Loading