Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 14 additions & 33 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: 'Run NRedisStack tests'
description: 'Runs NRedisStack tests against different Redis versions and configurations'
inputs:
inputs:
dotnet-version:
description: 'SDK version'
required: true
redis-version:
description: 'Redis version to test against'
description: 'Redis version to test against (MAJOR.MINOR format, e.g., "7.4", "8.0")'
required: true
verify-nuget-package:
description: 'Verify Nuget package'
Expand Down Expand Up @@ -36,45 +36,26 @@ runs:
- name: Setup Environment variables and run Redis
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::Setup Environment variables and run Redis"
dotnet_major_minor_version=$(echo "${{ inputs.dotnet-version }}" | grep -oP '^\d+\.\d+')
echo "CLR_VERSION=net${dotnet_major_minor_version}" >> $GITHUB_ENV

redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV

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"]="rs-7.4.0-v5"
["7.2.6"]="rs-7.2.0-v17"
["6.2.16"]="rs-6.2.6-v17"
)

if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
export CLIENT_LIBS_TEST_IMAGE="redislabs/client-libs-test:${redis_stack_version_mapping[$REDIS_VERSION]}"
else
echo "Version not found in the mapping."
exit 1
fi

if (( redis_major_version < 7 )); then
export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
fi

docker compose --profile all -f tests/dockers/docker-compose.yml up -d --build
# Load environment variables from version-specific file
ENV_FILE="tests/dockers/.env.v${REDIS_VERSION}"
if [[ -f "$ENV_FILE" ]]; then
echo "Loading environment from $ENV_FILE"
set -a
source "$ENV_FILE"
set +a
else
echo "Using redis CE for module tests"
export CLIENT_LIBS_TEST_IMAGE="redislabs/client-libs-test:$REDIS_VERSION"
docker compose --profile all -f tests/dockers/docker-compose.yml up -d --build
echo "Environment file not found: $ENV_FILE"
exit 1
fi

docker compose --profile all -f tests/dockers/docker-compose.yml up -d --build
echo "::endgroup::"
shell: bash

Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,16 @@ concurrency:

env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CURRENT_REDIS_VERSION: '8.2.3'

jobs:
redis_version:
runs-on: ubuntu-latest
outputs:
CURRENT: ${{ env.CURRENT_REDIS_VERSION }}
steps:
- name: Compute outputs
run: |
echo "CURRENT=${{ env.CURRENT_REDIS_VERSION }}" >> $GITHUB_OUTPUT

tests:
runs-on: ubuntu-latest
timeout-minutes: 60
needs: redis_version
strategy:
max-parallel: 15
fail-fast: false
matrix:
redis-version: [ '8.4.0', '${{ needs.redis_version.outputs.CURRENT }}', '7.4.1', '7.2.6', '6.2.16']
redis-version: [ '8.6', '8.4', '8.2', '7.4', '7.2', '6.2']
dotnet-version: ['8.0', '9.0']
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
Expand Down
1 change: 1 addition & 0 deletions tests/Doc/GeoIndexExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using NRedisStack.Tests;

namespace Doc;

[Collection("DocsTests")]
// REMOVE_END

Expand Down
2 changes: 1 addition & 1 deletion tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void InfoSearchSection(string endpointId)
IServer server = getAnyPrimary(muxer);

var searchInfo = server.Info("search");
CustomAssertions.GreaterThan(10, searchInfo.Length);
CustomAssertions.GreaterThan(searchInfo.Length, 8);
}

}
4 changes: 2 additions & 2 deletions tests/NRedisStack.Tests/Tdigest/TdigestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void TestCreateSimple(string endpointId)
var info = tdigest.Info(key);
Assert.Equal(610, info.Capacity);
Assert.Equal(100, info.Compression);
Assert.Equal(9768, info.MemoryUsage);
Assert.True(info.MemoryUsage is >= 9500 and <= 10000);
Assert.Equal(0, info.MergedNodes);
Assert.Equal(0, info.MergedWeight);
Assert.Equal(0, info.Observations);
Expand All @@ -59,7 +59,7 @@ public async Task TestCreateSimpleAsync(string endpointId)
var info = await tdigest.InfoAsync(key);
Assert.Equal(610, info.Capacity);
Assert.Equal(100, info.Compression);
Assert.Equal(9768, info.MemoryUsage);
Assert.True(info.MemoryUsage is >= 9500 and <= 10000);
Assert.Equal(0, info.MergedNodes);
Assert.Equal(0, info.MergedWeight);
Assert.Equal(0, info.Observations);
Expand Down
9 changes: 9 additions & 0 deletions tests/dockers/.env.v6.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Environment variables for Redis 6.2.x
# Used by the run-tests GitHub Action

# Redis Stack image version for module tests
CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:rs-6.2.6-v17

# Additional Redis arguments for this version
REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"

6 changes: 6 additions & 0 deletions tests/dockers/.env.v7.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Environment variables for Redis 7.2.x
# Used by the run-tests GitHub Action

# Redis Stack image version for module tests
CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:rs-7.2.0-v20

6 changes: 6 additions & 0 deletions tests/dockers/.env.v7.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Environment variables for Redis 7.4.x
# Used by the run-tests GitHub Action

# Redis Stack image version for module tests
CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:rs-7.4.0-v8

6 changes: 6 additions & 0 deletions tests/dockers/.env.v8.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Environment variables for Redis 8.0.x
# Used by the run-tests GitHub Action

# Redis CE image version (Redis 8+ includes modules natively)
CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:8.0.5

6 changes: 6 additions & 0 deletions tests/dockers/.env.v8.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Environment variables for Redis 8.2.x
# Used by the run-tests GitHub Action

# Redis CE image version (Redis 8+ includes modules natively)
CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:8.2.3

6 changes: 6 additions & 0 deletions tests/dockers/.env.v8.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Environment variables for Redis 8.4.x
# Used by the run-tests GitHub Action

# Redis CE image version (Redis 8+ includes modules natively)
CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:8.4.0

6 changes: 6 additions & 0 deletions tests/dockers/.env.v8.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Environment variables for Redis 8.6
# Used by the run-tests GitHub Action

# Redis CE image version (Redis 8+ includes modules natively)
CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:custom-21183968220-debian-amd64

Loading