From 7442202be8593655738be84e0b36c63123390130 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:12:54 +0100 Subject: [PATCH 01/10] Use .env files to map Redis versions to images --- .github/actions/run-tests/action.yml | 47 +++++++++------------------- .github/workflows/integration.yml | 12 +------ tests/dockers/.env.v6.2 | 9 ++++++ tests/dockers/.env.v7.2 | 6 ++++ tests/dockers/.env.v7.4 | 6 ++++ tests/dockers/.env.v8.0 | 6 ++++ tests/dockers/.env.v8.2 | 6 ++++ tests/dockers/.env.v8.4 | 6 ++++ tests/dockers/.env.v8.6 | 6 ++++ 9 files changed, 60 insertions(+), 44 deletions(-) create mode 100644 tests/dockers/.env.v6.2 create mode 100644 tests/dockers/.env.v7.2 create mode 100644 tests/dockers/.env.v7.4 create mode 100644 tests/dockers/.env.v8.0 create mode 100644 tests/dockers/.env.v8.2 create mode 100644 tests/dockers/.env.v8.4 create mode 100644 tests/dockers/.env.v8.6 diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index 67a1b631..d9acc64b 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -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' @@ -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 diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index e297b403..fc130c5d 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -17,18 +17,8 @@ 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 @@ -37,7 +27,7 @@ jobs: 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 diff --git a/tests/dockers/.env.v6.2 b/tests/dockers/.env.v6.2 new file mode 100644 index 00000000..4f0bd0db --- /dev/null +++ b/tests/dockers/.env.v6.2 @@ -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-v20 + +# Additional Redis arguments for this version +REDIS_EXTRA_ARGS=--tls-auth-clients optional --save '' + diff --git a/tests/dockers/.env.v7.2 b/tests/dockers/.env.v7.2 new file mode 100644 index 00000000..ecc09e63 --- /dev/null +++ b/tests/dockers/.env.v7.2 @@ -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 + diff --git a/tests/dockers/.env.v7.4 b/tests/dockers/.env.v7.4 new file mode 100644 index 00000000..aaf439a9 --- /dev/null +++ b/tests/dockers/.env.v7.4 @@ -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 + diff --git a/tests/dockers/.env.v8.0 b/tests/dockers/.env.v8.0 new file mode 100644 index 00000000..52760e5d --- /dev/null +++ b/tests/dockers/.env.v8.0 @@ -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 + diff --git a/tests/dockers/.env.v8.2 b/tests/dockers/.env.v8.2 new file mode 100644 index 00000000..834f7d3e --- /dev/null +++ b/tests/dockers/.env.v8.2 @@ -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 + diff --git a/tests/dockers/.env.v8.4 b/tests/dockers/.env.v8.4 new file mode 100644 index 00000000..8be51cb7 --- /dev/null +++ b/tests/dockers/.env.v8.4 @@ -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 + diff --git a/tests/dockers/.env.v8.6 b/tests/dockers/.env.v8.6 new file mode 100644 index 00000000..87b955e7 --- /dev/null +++ b/tests/dockers/.env.v8.6 @@ -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 + From b6fa35dc0eda64398bfeae4f8fed6ff50dbdbc3f Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:15:44 +0100 Subject: [PATCH 02/10] Remove dependency on redis_version --- .github/workflows/integration.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index fc130c5d..1b932003 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -22,7 +22,6 @@ jobs: tests: runs-on: ubuntu-latest timeout-minutes: 60 - needs: redis_version strategy: max-parallel: 15 fail-fast: false From 5f32506ed6c2cb623cca8c1e464e68065faaff7e Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:18:05 +0100 Subject: [PATCH 03/10] Revert to 6.2 to rs-6.2.6-v17 --- tests/dockers/.env.v6.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dockers/.env.v6.2 b/tests/dockers/.env.v6.2 index 4f0bd0db..b7e7cdf1 100644 --- a/tests/dockers/.env.v6.2 +++ b/tests/dockers/.env.v6.2 @@ -2,7 +2,7 @@ # 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-v20 +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 '' From 52dc1da3cb2522b14b0b2c7682433a57b9c9a7a9 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:20:01 +0100 Subject: [PATCH 04/10] Fix again --- tests/dockers/.env.v6.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dockers/.env.v6.2 b/tests/dockers/.env.v6.2 index b7e7cdf1..f5f22b71 100644 --- a/tests/dockers/.env.v6.2 +++ b/tests/dockers/.env.v6.2 @@ -5,5 +5,5 @@ 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 '' +REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''" From b6a233974ebac78c9acadffb48cb37e53510e81c Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:35:56 +0100 Subject: [PATCH 05/10] Use range assertion for Tdigest --- tests/NRedisStack.Tests/Tdigest/TdigestTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/NRedisStack.Tests/Tdigest/TdigestTests.cs b/tests/NRedisStack.Tests/Tdigest/TdigestTests.cs index 1b49c559..e8189335 100644 --- a/tests/NRedisStack.Tests/Tdigest/TdigestTests.cs +++ b/tests/NRedisStack.Tests/Tdigest/TdigestTests.cs @@ -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); @@ -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); From 299597bd6533abec5011d9527e0eba759babd144 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:47:34 +0100 Subject: [PATCH 06/10] Reduce number of expected Search fields --- tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs b/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs index c4630c22..a06c78a2 100644 --- a/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs +++ b/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs @@ -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(9, searchInfo.Length); } } \ No newline at end of file From b47ecf9c1eed46ef34f28a3ea4a26b0525218986 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:51:54 +0100 Subject: [PATCH 07/10] Fix assertion in InfoSearchSection --- tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs b/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs index a06c78a2..450ad026 100644 --- a/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs +++ b/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs @@ -103,7 +103,7 @@ public void InfoSearchSection(string endpointId) IServer server = getAnyPrimary(muxer); var searchInfo = server.Info("search"); - CustomAssertions.GreaterThan(9, searchInfo.Length); + CustomAssertions.GreaterThan(searchInfo.Length, 10); } } \ No newline at end of file From 117034068e6f3388eda805d8d71323eaede3666b Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:55:09 +0100 Subject: [PATCH 08/10] Ok, so there was 9 fields on 8.2 --- tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs b/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs index 450ad026..956095fb 100644 --- a/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs +++ b/tests/NRedisStack.Tests/CommunityEditionUpdatesTests.cs @@ -103,7 +103,7 @@ public void InfoSearchSection(string endpointId) IServer server = getAnyPrimary(muxer); var searchInfo = server.Info("search"); - CustomAssertions.GreaterThan(searchInfo.Length, 10); + CustomAssertions.GreaterThan(searchInfo.Length, 8); } } \ No newline at end of file From e98e7dc879f68c7dd95cc54da60732fb7320e206 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 21 Jan 2026 11:59:49 +0100 Subject: [PATCH 09/10] Make dotnet format happy --- tests/Doc/GeoIndexExample.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Doc/GeoIndexExample.cs b/tests/Doc/GeoIndexExample.cs index b7c78574..c4b94ff1 100644 --- a/tests/Doc/GeoIndexExample.cs +++ b/tests/Doc/GeoIndexExample.cs @@ -11,6 +11,7 @@ using NRedisStack.Tests; namespace Doc; + [Collection("DocsTests")] // REMOVE_END From 596920d26ad4fe528e8cb1d7ddb1a27da5b0e182 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Thu, 29 Jan 2026 15:00:07 +0100 Subject: [PATCH 10/10] Bump 8.6 image tag --- tests/dockers/.env.v8.6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dockers/.env.v8.6 b/tests/dockers/.env.v8.6 index 87b955e7..08c62199 100644 --- a/tests/dockers/.env.v8.6 +++ b/tests/dockers/.env.v8.6 @@ -2,5 +2,5 @@ # 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 +CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:8.6-rc1-21356658603-debian-amd64