Skip to content
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

Introduces test matrix based on Redis versions [8.0-M1, 7.4.1, 7.2.6, 6.2.16] #4015

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1ce4f31
Introduces test matrix based on Redis versions [8.0-M1, 7.4.1, 7.2.6,…
ggivo Nov 10, 2024
da0474d
Fix GeoXXX tests
ggivo Nov 10, 2024
90d93a3
REDIS_VERSION env var for setting test container version
ggivo Nov 11, 2024
2f7ee06
Remove accidentally submitted conf directive
ggivo Nov 11, 2024
2ab47f9
Revert changes in integration action
ggivo Nov 11, 2024
47207c9
EnabledOnCommandRule get info only for requested command
ggivo Nov 11, 2024
7975ce1
Remove accidentally added SinceRedisVersion 7.0.0 for ControlCommands…
ggivo Nov 11, 2024
c975df1
Found issue with CommandInfo command
ggivo Nov 11, 2024
3818236
Use SinceRedisVersion instead of "EnableOnCmmand" because of https://…
ggivo Nov 11, 2024
ef9a65b
Use SinceRedisVersion instead of "EnableOnCommand" because of https:/…
ggivo Nov 11, 2024
9ae14bc
switch default TEST_ENV_PROVIDER
ggivo Nov 11, 2024
347c3f7
Use CommandInfo for subcommand
sazzad16 Nov 12, 2024
c5564e7
Get Iterable from Map
sazzad16 Nov 12, 2024
513c0a5
Use client-libs-test image based on redis-server-stack
ggivo Nov 12, 2024
c946450
Fix: command and subcommand are concatenated with a pipe
sazzad16 Nov 12, 2024
185ea05
Remove commented out code
ggivo Nov 13, 2024
18168f8
Revert "Use client-libs-test image based on redis-server-stack"
ggivo Nov 14, 2024
475ff12
Use native redis TLS support
ggivo Nov 19, 2024
208f37c
Introduce forceRedisServerVersion into test
ggivo Nov 19, 2024
ddae82f
Fix accidently removed default for 6.2.16 version
ggivo Nov 19, 2024
d1c5a82
Generate .key from private.pem
ggivo Nov 19, 2024
7088ed1
add ::1 to expected local ip's in the test
ggivo Nov 19, 2024
7528799
add ::1 to expected local ip's in the test
ggivo Nov 19, 2024
9210bc5
Switch ctest env setup default from 'local' to 'docker'
ggivo Nov 19, 2024
4fcd47b
Mark SSL & ACL test's since 7.0
ggivo Nov 19, 2024
a34d631
Mark SSL & ACL test's since 7.0
ggivo Nov 19, 2024
1698b76
Fix NPE in test clean up
ggivo Nov 19, 2024
83cf38d
Add how to bootstrap test env with Docker
ggivo Nov 20, 2024
accfea2
Merge branch 'master' into migrate_to_clients_test_image
uglide Nov 22, 2024
e1c0453
Add make target to start containerised test env.
ggivo Nov 23, 2024
a826afb
use dedicate .env file for 6.2.16
ggivo Nov 23, 2024
6c58815
Apply review comments
ggivo Nov 25, 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
39 changes: 39 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,45 @@ Jedis unit tests use many Redis instances, so we use a ```Makefile``` to prepare
Start unit tests with ```make test```.
Set up test environments with ```make start```, tear down those environments with ```make stop``` and clean up the environment files with ```make cleanup```.


# Jedis Test Environment Using Docker

This guide explains how to bootstrap and manage a test environment for Jedis using Docker Compose.

## Workflow Steps
1. **Start the test environment** by running the following command (examples below).
- For instance, to start the environment with Redis 8.0-M01, use `make start-test-env`.
2. **Run tests** through your IDE, Maven, or other testing tools as needed.
3. **Stop the test environment** by running the following command:
- `make stop-test-env`
- This will stop and tear down the Docker containers running the Redis service

# Start the Test Environment Using Docker

You can bootstrap the test environment for supported versions of Redis using the provided `make` targets.

## Option 1: Using `make` Targets
To bring up the test environment for a specific Redis version (8.0-M01, 7.4.1, 7.2.6, or 6.2.16), use the following command:
```bash
make start-test-env version=8.0-M01 # Replace with desired version
```

## Option 2: Using docker compose commands directly
Docker compose file can be found in `src/test/resources/env` folder.
- **Redis 8.0-M01, 7.4.1, 7.2.6**
```bash
rm -rf /tmp/redis-env-work
export REDIS_VERSION=8.0-M01
docker compose up
```
- **Redis 6.2.16**
- **NOTE:** Redis 6.2.16 uses a dedicated `.env.v6.2.16`.
```bash
rm -rf /tmp/redis-env-work
docker compose --env-file .env.v6.2.16 up
```


# Some rules of Jedis source code

## Code Convention
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
mvn javadoc:jar
- name: Run tests
run: |
export TEST_ENV_PROVIDER=local
make test
env:
JVM_OPTS: -Xmx3200m
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/test-on-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---

name: Build and Test using containerized environment
ggivo marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
paths-ignore:
- 'docs/**'
- '**/*.md'
- '**/*.rst'
branches:
- master
- '[0-9].*'
pull_request:
branches:
- master
- '[0-9].*'
schedule:
- cron: '0 1 * * *' # nightly build
workflow_dispatch:
inputs:
specific_test:
description: 'Run specific test(s) (optional)'
required: false
default: ''
jobs:

build:
name: Build and Test
runs-on: ubuntu-latest
env:
REDIS_ENV_WORK_DIR: ${{ github.workspace }}/redis-env-work
REDIS_ENV_CONF_DIR: ${{ github.workspace }}/src/test/resources/env
CLIENT_LIBS_IMAGE_PREFIX: "redislabs/client-libs-test"
strategy:
fail-fast: false
matrix:
redis_version:
- "8.0-M01"
- "7.4.1"
- "7.2.6"
- "6.2.16"
steps:
- uses: actions/checkout@v2
- name: Set up publishing to maven central
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
- name: System setup
run: |
sudo apt update
sudo apt install -y make
make compile-module
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.m2/repository
/var/cache/apt
key: jedis-${{hashFiles('**/pom.xml')}}
# Set up Docker Compose environment
- name: Set up Docker Compose environment
run: |
mkdir -m 777 $REDIS_ENV_WORK_DIR
export REDIS_VERSION="${{ matrix.redis_version }}"
export COMPOSE_ENV_FILES="src/test/resources/env/.env"
if [[ "${{ matrix.redis_version }}" == "6.2.16" ]]; then
COMPOSE_ENV_FILES="src/test/resources/env/.env.v${{ matrix.redis_version }}"
fi
docker compose -f src/test/resources/env/docker-compose.yml up -d
- name: Maven offline
run: |
mvn -q dependency:go-offline
- name: Build docs
run: |
mvn javadoc:jar
# Run Tests
- name: Run Maven tests
run: |
export TEST_ENV_PROVIDER=docker
export TEST_WORK_FOLDER=$REDIS_ENV_WORK_DIR
echo $TEST_WORK_FOLDER
if [ -z "$TESTS" ]; then
mvn clean compile test
else
mvn -Dtest=$SPECIFIC_TEST clean compile test
fi
env:
TESTS: ${{ github.event.inputs.specific_test || '' }}
ggivo marked this conversation as resolved.
Show resolved Hide resolved
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
target/surefire-reports/**/*.xml
# Collect logs on failure
- name: Collect logs on failure
if: failure() # This runs only if the previous steps failed
run: |
echo "Collecting logs from $WORK_DIR..."
ls -la $REDIS_ENV_WORK_DIR
# Upload logs as artifacts
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: redis-env-work-logs
path: ${{ env.REDIS_ENV_WORK_DIR }}
# Bring down the Docker Compose test environment
- name: Tear down Docker Compose environment
if: always()
run: |
docker compose $COMPOSE_ENV_FILES -f src/test/resources/env/docker-compose.yml down
continue-on-error: true
# Upload code coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ github.event_name == 'schedule' || (github.event_name == 'push') || github.event_name == 'workflow_dispatch'}}
uses: codecov/test-results-action@v1
with:
fail_ci_if_error: false
files: ./target/surefire-reports/TEST*
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ build/
bin/
tags
.idea
.run
*.aof
*.rdb
redis-git
appendonlydir/
.DS_Store
Loading
Loading