diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml
new file mode 100644
index 00000000..a9110779
--- /dev/null
+++ b/.github/actions/run-tests/action.yml
@@ -0,0 +1,136 @@
+name: 'Run NRedisStack tests'
+description: 'Runs NRedisStack tests against different Redis versions and configurations'
+inputs:
+ dotnet-version:
+ description: 'SDK version'
+ required: true
+ redis-version:
+ description: 'Redis version to test against'
+ required: true
+ verify-nuget-package:
+ description: 'Verify Nuget package'
+ required: false
+ default: 'false'
+ REDIS_CA_PEM:
+ description: 'Redis CA PEM'
+ required: true
+ REDIS_USER_CRT:
+ description: 'Redis User CRT'
+ required: true
+ REDIS_USER_PRIVATE_KEY:
+ description: 'Redis User Private Key'
+ required: true
+runs:
+ using: "composite"
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install .NET Core
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: ${{inputs.dotnet-version}}
+ dotnet-quality: 'ga'
+
+ - 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-v1"
+ ["7.2.6"]="rs-7.2.0-v13"
+ ["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
+ 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
+ fi
+ echo "::endgroup::"
+ shell: bash
+
+ # Make sure only the desired dotnet version is set both as target and as active SDK.
+ - name: Tweak target frameworks
+ shell: bash
+ run: |
+ find . -name '*.csproj' | xargs -I {} sed -E -i "s|.*|${CLR_VERSION}|" {}
+ find . -name '*.csproj' | xargs cat
+ jq -n --arg version ${{inputs.dotnet-version}} '{"sdk":{"version":$version,"rollForward":"latestMinor"}}' > global.json
+ - name: Check .NET version
+ shell: bash
+ run: dotnet --version
+ - name: Check .NET SDKs
+ shell: bash
+ run: dotnet --list-sdks
+ - name: Check .NET runtimes
+ shell: bash
+ run: dotnet --list-runtimes
+ - name: Restore dependencies
+ shell: bash
+ run: dotnet restore
+
+ - name: Build
+ shell: bash
+ run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
+
+ - name: Test
+ shell: bash
+ run: |
+ echo "::group::Run tests"
+ echo "${{inputs.REDIS_CA_PEM}}" > tests/NRedisStack.Tests/bin/Debug/${CLR_VERSION}/redis_ca.pem
+ echo "${{inputs.REDIS_USER_CRT}}" > tests/NRedisStack.Tests/bin/Debug/${CLR_VERSION}/redis_user.crt
+ echo "${{inputs.REDIS_USER_PRIVATE_KEY}}" > tests/NRedisStack.Tests/bin/Debug/${CLR_VERSION}/redis_user_private.key
+ dotnet test -f ${CLR_VERSION} --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover -p:BuildInParallel=false tests/Test.proj --logger GitHubActions
+ echo "::endgroup::"
+ - name: Codecov
+ uses: codecov/codecov-action@v4
+ with:
+ verbose: true
+ - name: Build
+ shell: bash
+ run: dotnet pack -c Release
+
+ - name: Test against Nuget package from local source
+ if: inputs.verify-nuget-package == 'true'
+ working-directory: PackageVerification
+ shell: bash
+ run: |
+ echo "::group::Test against Nuget package from local source"
+ mkdir -p test-source
+ dotnet nuget add source $(readlink -f test-source) -n test-source
+ find .. -name '*.nupkg' | xargs -I {} dotnet nuget push {} -s test-source
+ ls -R
+ dotnet nuget remove source nuget.org
+ dotnet nuget list source
+ find . -name '*.csproj' | xargs -I {} sed -E -i 's|.*|${CLR_VERSION}|' {}
+ dotnet restore -s test-source -v detailed
+ dotnet run
+ echo "::endgroup::"
+
diff --git a/.github/docker-compose.yml b/.github/docker-compose.yml
deleted file mode 100644
index d56217a5..00000000
--- a/.github/docker-compose.yml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-version: "3.8"
-services:
-
- redis-stack-7.2.0-RC3:
- image: redis/redis-stack-server:7.2.0-RC3
- ports: ["6379:6379"]
-
- redis-stack-6.2.6:
- image: redis/redis-stack-server:6.2.6-v9
- ports: ["6379:6379"]
-
- redis-stack-edge:
- image: redis/redis-stack-server:edge
- ports: ["6379:6379"]
-
- redis-stack-cluster:
- container_name: redis-cluster
- build:
- context: .
- dockerfile: dockers/Dockerfile.cluster
- ports:
- - 16379:16379
- - 16380:16380
- - 16381:16381
- - 16382:16382
- - 16383:16383
- - 16384:16384
- volumes:
- - "./dockers/cluster.redis.conf:/redis.conf:ro"
\ No newline at end of file
diff --git a/.github/dockers/Dockerfile.cluster b/.github/dockers/Dockerfile.cluster
deleted file mode 100644
index 3a0d7341..00000000
--- a/.github/dockers/Dockerfile.cluster
+++ /dev/null
@@ -1,7 +0,0 @@
-FROM redis/redis-stack-server:edge as rss
-
-COPY dockers/create_cluster.sh /create_cluster.sh
-RUN ls -R /opt/redis-stack
-RUN chmod a+x /create_cluster.sh
-
-ENTRYPOINT [ "/create_cluster.sh"]
diff --git a/.github/dockers/cluster.redis.conf b/.github/dockers/cluster.redis.conf
deleted file mode 100644
index 901d17ae..00000000
--- a/.github/dockers/cluster.redis.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-protected-mode no
-enable-debug-command yes
-loadmodule /opt/redis-stack/lib/redisearch.so
-# loadmodule /opt/redis-stack/lib/redisgraph.so
-loadmodule /opt/redis-stack/lib/redistimeseries.so
-loadmodule /opt/redis-stack/lib/rejson.so
-loadmodule /opt/redis-stack/lib/redisbloom.so
-loadmodule /opt/redis-stack/lib/redisgears.so v8-plugin-path /opt/redis-stack/lib/libredisgears_v8_plugin.so
diff --git a/.github/dockers/create_cluster.sh b/.github/dockers/create_cluster.sh
deleted file mode 100644
index da9a0cb6..00000000
--- a/.github/dockers/create_cluster.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#! /bin/bash
-
-mkdir -p /nodes
-touch /nodes/nodemap
-if [ -z ${START_PORT} ]; then
- START_PORT=16379
-fi
-if [ -z ${END_PORT} ]; then
- END_PORT=16384
-fi
-if [ ! -z "$3" ]; then
- START_PORT=$2
- START_PORT=$3
-fi
-echo "STARTING: ${START_PORT}"
-echo "ENDING: ${END_PORT}"
-
-for PORT in `seq ${START_PORT} ${END_PORT}`; do
- mkdir -p /nodes/$PORT
- if [[ -e /redis.conf ]]; then
- cp /redis.conf /nodes/$PORT/redis.conf
- else
- touch /nodes/$PORT/redis.conf
- fi
- cat << EOF >> /nodes/$PORT/redis.conf
-port ${PORT}
-cluster-enabled yes
-daemonize yes
-logfile /redis.log
-dir /nodes/$PORT
-EOF
-
- set -x
- /opt/redis-stack/bin/redis-server /nodes/$PORT/redis.conf
- sleep 1
- if [ $? -ne 0 ]; then
- echo "Redis failed to start, exiting."
- continue
- fi
- echo 127.0.0.1:$PORT >> /nodes/nodemap
-done
-if [ -z "${REDIS_PASSWORD}" ]; then
- echo yes | /opt/redis-stack/bin/redis-cli --cluster create `seq -f 127.0.0.1:%g ${START_PORT} ${END_PORT}` --cluster-replicas 1
-else
- echo yes | opt/redis-stack/bin/redis-cli -a ${REDIS_PASSWORD} --cluster create `seq -f 127.0.0.1:%g ${START_PORT} ${END_PORT}` --cluster-replicas 1
-fi
-tail -f /redis.log
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index 0b5d6027..c6c91e56 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -15,164 +15,94 @@ concurrency:
group: ${{ github.event.pull_request.number || github.ref }}-integration
cancel-in-progress: true
-jobs:
- enterprise-tests:
- name: Redis Enterprise
- runs-on: ubuntu-latest
-
- strategy:
- fail-fast: false
- matrix:
- enterprise_version: ['7.4.2-54']
- env_file_mode: ['enterprise', 'enterprise_oss_cluster']
-
- steps:
- - uses: actions/checkout@v4
-
- - name: Load dotnenv for CI
- uses: xom9ikk/dotenv@v2
- with:
- path: .github/workflows/modes
- mode: ${{ matrix.env_file_mode }}
-
- - name: Clone ee docker code
- uses: actions/checkout@v4
- with:
- repository: redislabs/redis-ee-docker
- path: redis-ee-docker
-
- - name: Start docker
- working-directory: redis-ee-docker
- env:
- IMAGE: redislabs/redis:${{ matrix.enterprise_version }}
- run: ./build.sh
-
- - name: .NET Core 8
- uses: actions/setup-dotnet@v2
- with:
- dotnet-version: '8.0.x'
-
- - name: Restore dependencies
- run: dotnet restore
-
- - name: Build
- run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
+env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+ CURRENT_REDIS_VERSION: '7.4.1'
- - name: Test
- run: dotnet test -f net8.0 --no-build --verbosity detailed -p:BuildInParallel=false tests/Test.proj --logger GitHubActions
-
- dotnet_6_cluster:
- name: .NET 6 on [redis-stack cluster]
- uses: ./.github/workflows/reusable.yml
- with:
- redis_stack_type: cluster
- clr_version: net6.0
- mode: oss_cluster
- dotnet_sdk_version: 6.0.0
- secrets: inherit
-
- dotnet_6:
- name: .NET 6 on [redis-stack ${{matrix.redis-stack-type}}]
- uses: ./.github/workflows/reusable.yml
- strategy:
- fail-fast: false
- max-parallel: 5
- matrix:
- redis-stack-type: ['edge', '6.2.6', '7.2.0-RC3']
- with:
- redis_stack_type: ${{matrix.redis-stack-type}}
- clr_version: net6.0
- mode: standalone
- dotnet_sdk_version: 6.0.0
- secrets: inherit
-
- dotnet_7_cluster:
- name: .NET 7 on [redis-stack cluster]
- uses: ./.github/workflows/reusable.yml
- with:
- redis_stack_type: cluster
- clr_version: net7.0
- mode: oss_cluster
- dotnet_sdk_version: 7.0.0
- secrets: inherit
-
- dotnet_7:
- name: .NET 7 on [redis-stack ${{matrix.redis-stack-type}}]
- uses: ./.github/workflows/reusable.yml
- strategy:
- fail-fast: false
- max-parallel: 5
- matrix:
- redis-stack-type: ['edge', '6.2.6', '7.2.0-RC3']
- with:
- redis_stack_type: ${{matrix.redis-stack-type}}
- clr_version: net7.0
- mode: standalone
- dotnet_sdk_version: 7.0.0
- secrets: inherit
-
- dotnet_8_cluster:
- name: .NET 8 on [redis-stack cluster]
- uses: ./.github/workflows/reusable.yml
- with:
- redis_stack_type: cluster
- clr_version: net8.0
- mode: oss_cluster
- dotnet_sdk_version: 8.0.0
- secrets: inherit
-
- dotnet_8:
- name: .NET 8 on [redis-stack ${{matrix.redis-stack-type}}]
- uses: ./.github/workflows/reusable.yml
- strategy:
- fail-fast: false
- max-parallel: 5
- matrix:
- redis-stack-type: ['edge', '6.2.6', '7.2.0-RC3']
- with:
- redis_stack_type: ${{matrix.redis-stack-type}}
- clr_version: net8.0
- mode: standalone
- dotnet_sdk_version: 8.0.0
- secrets: inherit
-
- build_and_test_windows:
- name: Windows Test ${{matrix.redis-stack-version}}
- runs-on: windows-latest
- strategy:
- fail-fast: false
- matrix:
- redis-stack-version: ['6.2.6-v9', '7.2.0-RC3']
- env:
- redis_stack_version: ${{matrix.redis-stack-version}}
- USER_NAME: ${{ secrets.USER_NAME }}
- PASSWORD: ${{ secrets.PASSWORD }}
- ENDPOINT: ${{ secrets.ENDPOINT }}
- steps:
- - uses: actions/checkout@v3
- - uses: Vampire/setup-wsl@v2
- with:
- distribution: Ubuntu-22.04
- - name: Install Redis
- shell: wsl-bash {0}
- run: |
- sudo apt-get update
- sudo apt-get install curl -y && sudo apt-get install gpg -y && apt-get install lsb-release -y && apt-get install libgomp1 -y
- curl https://packages.redis.io/redis-stack/redis-stack-server-${{env.redis_stack_version}}.jammy.x86_64.tar.gz -o redis-stack.tar.gz
- tar xf redis-stack.tar.gz
- - name: Restore dependencies
- run: dotnet restore
- - name: Build
- run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
- - name: Save test certificates
- shell: wsl-bash {0}
- run: |
- echo "${{secrets.REDIS_CA_PEM}}" > tests/NRedisStack.Tests/bin/Debug/net481/redis_ca.pem
- echo "${{secrets.REDIS_USER_CRT}}" > tests/NRedisStack.Tests/bin/Debug/net481/redis_user.crt
- echo "${{secrets.REDIS_USER_PRIVATE_KEY}}" > tests/NRedisStack.Tests/bin/Debug/net481/redis_user_private.key
- ls -R
- - name: Test
- shell: cmd
- run: |
- START wsl ./redis-stack-server-${{env.redis_stack_version}}/bin/redis-stack-server &
- dotnet test -f net481 --no-build --verbosity detailed -p:BuildInParallel=false tests/Test.proj --logger GitHubActions
+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: [ '${{ needs.redis_version.outputs.CURRENT }}', '7.2.6', '6.2.16']
+ dotnet-version: ['6.0', '7.0', '8.0']
+ env:
+ ACTIONS_ALLOW_UNSECURE_COMMANDS: true
+ name: Redis ${{ matrix.redis-version }}; .NET ${{ matrix.dotnet-version }};
+ steps:
+ - uses: actions/checkout@v4
+ - name: Run tests
+ uses: ./.github/actions/run-tests
+ with:
+ dotnet-version: ${{ matrix.dotnet-version }}
+ redis-version: ${{ matrix.redis-version }}
+ REDIS_CA_PEM: ${{ secrets.REDIS_CA_PEM }}
+ REDIS_USER_CRT: ${{ secrets.REDIS_USER_CRT }}
+ REDIS_USER_PRIVATE_KEY: ${{ secrets.REDIS_USER_PRIVATE_KEY }}
+
+ build_and_test_windows:
+ name: Windows Test ${{matrix.redis-stack-version}}
+ runs-on: windows-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ redis-stack-version: ['6.2.6-v18', '7.2.0-v14', '7.4.0-v2']
+ env:
+ redis_stack_version: ${{matrix.redis-stack-version}}
+ USER_NAME: ${{ secrets.USER_NAME }}
+ PASSWORD: ${{ secrets.PASSWORD }}
+ ENDPOINT: ${{ secrets.ENDPOINT }}
+ steps:
+ - uses: actions/checkout@v3
+ - uses: Vampire/setup-wsl@v2
+ with:
+ distribution: Ubuntu-22.04
+ - name: Install Redis
+ shell: wsl-bash {0}
+ run: |
+ sudo apt-get update
+ sudo apt-get install curl gpg lsb-release libgomp1 jq -y
+ curl https://packages.redis.io/redis-stack/redis-stack-server-${{env.redis_stack_version}}.jammy.x86_64.tar.gz -o redis-stack.tar.gz
+ tar xf redis-stack.tar.gz
+ - name: Restore dependencies
+ run: dotnet restore
+ - name: Build
+ run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
+ - name: Save test certificates
+ shell: wsl-bash {0}
+ run: |
+ export TARGET_DIR=tests/NRedisStack.Tests/bin/Debug/net481
+ echo "${{secrets.REDIS_CA_PEM}}" > ${TARGET_DIR}/redis_ca.pem
+ echo "${{secrets.REDIS_USER_CRT}}" > ${TARGET_DIR}/redis_user.crt
+ echo "${{secrets.REDIS_USER_PRIVATE_KEY}}" > ${TARGET_DIR}redis_user_private.key
+
+ # We need to remove the cluster endpoint from the endpoints.json file
+ # because we run only standalone redis-stack-server.
+ jq 'del(.cluster)' tests/dockers/endpoints.json > standalone_only.json
+ rm tests/dockers/endpoints.json && cp standalone_only.json tests/dockers/endpoints.json
+ cp -f standalone_only.json ${TARGET_DIR}/endpoints.json
+ cat tests/dockers/endpoints.json
+ cat ${TARGET_DIR}/endpoints.json
+ - name: Run redis-server
+ shell: wsl-bash {0}
+ run: |
+ ./redis-stack-server-${{env.redis_stack_version}}/bin/redis-stack-server &
+ sleep 3
+ ./redis-stack-server-${{env.redis_stack_version}}/bin/redis-cli INFO SERVER | grep redis_version
+ - name: Test
+ shell: cmd
+ run: |
+ dotnet test -f net481 --no-build --verbosity detailed -p:BuildInParallel=false tests/Test.proj --logger GitHubActions
diff --git a/.github/workflows/modes/.env.enterprise b/.github/workflows/modes/.env.enterprise
deleted file mode 100644
index 9a57f7f5..00000000
--- a/.github/workflows/modes/.env.enterprise
+++ /dev/null
@@ -1,7 +0,0 @@
-REDIS=127.0.0.1:6379
-IS_ENTERPRISE=true
-RE_USERNAME=test@test.com
-RE_PASS=12345
-RE_CLUSTER_NAME=test
-RE_USE_OSS_CLUSTER=false
-RE_DB_PORT=6379
diff --git a/.github/workflows/modes/.env.enterprise_oss_cluster b/.github/workflows/modes/.env.enterprise_oss_cluster
deleted file mode 100644
index 1b81f571..00000000
--- a/.github/workflows/modes/.env.enterprise_oss_cluster
+++ /dev/null
@@ -1,8 +0,0 @@
-REDIS_CLUSTER=127.0.0.1:6372
-NUM_REDIS_CLUSTER_NODES=3
-IS_ENTERPRISE=true
-RE_USERNAME=test@test.com
-RE_PASS=12345
-RE_CLUSTER_NAME=test
-RE_USE_OSS_CLUSTER=true
-RE_DB_PORT=6378
\ No newline at end of file
diff --git a/.github/workflows/modes/.env.oss_cluster b/.github/workflows/modes/.env.oss_cluster
deleted file mode 100644
index 0d2a2906..00000000
--- a/.github/workflows/modes/.env.oss_cluster
+++ /dev/null
@@ -1,2 +0,0 @@
-REDIS_CLUSTER=127.0.0.1:16379
-NUM_REDIS_CLUSTER_NODES=6
\ No newline at end of file
diff --git a/.github/workflows/modes/.env.standalone b/.github/workflows/modes/.env.standalone
deleted file mode 100644
index e0cfd098..00000000
--- a/.github/workflows/modes/.env.standalone
+++ /dev/null
@@ -1 +0,0 @@
-REDIS=localhost:6379
\ No newline at end of file
diff --git a/tests/Doc/Bf_tutorial.cs b/tests/Doc/Bf_tutorial.cs
index 6d08c2e2..e85fb0dc 100644
--- a/tests/Doc/Bf_tutorial.cs
+++ b/tests/Doc/Bf_tutorial.cs
@@ -16,7 +16,6 @@ namespace Doc;
public class Bf_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/Bitmap_tutorial.cs b/tests/Doc/Bitmap_tutorial.cs
index b6892040..f4452068 100644
--- a/tests/Doc/Bitmap_tutorial.cs
+++ b/tests/Doc/Bitmap_tutorial.cs
@@ -15,7 +15,6 @@ namespace Doc;
public class Bitmap_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/CmdsGenericExample.cs b/tests/Doc/CmdsGenericExample.cs
index 950805bd..448c6efb 100644
--- a/tests/Doc/CmdsGenericExample.cs
+++ b/tests/Doc/CmdsGenericExample.cs
@@ -15,7 +15,6 @@ namespace Doc;
public class CmdsGenericExample
{
- [SkipIfRedis(Is.OSSCluster, Comparison.LessThan, "7.0.0")]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/CmdsHashExample.cs b/tests/Doc/CmdsHashExample.cs
index 977e8ae6..d2c4e33f 100644
--- a/tests/Doc/CmdsHashExample.cs
+++ b/tests/Doc/CmdsHashExample.cs
@@ -13,7 +13,6 @@ namespace Doc;
public class CmdsHashExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/CmdsSortedSetExamples.cs b/tests/Doc/CmdsSortedSetExamples.cs
index 6ae81201..99fa8b32 100644
--- a/tests/Doc/CmdsSortedSetExamples.cs
+++ b/tests/Doc/CmdsSortedSetExamples.cs
@@ -15,7 +15,6 @@ namespace Doc;
public class CmdsSortedSet
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/CmdsStringExample.cs b/tests/Doc/CmdsStringExample.cs
index 462cacd1..dce5daf4 100644
--- a/tests/Doc/CmdsStringExample.cs
+++ b/tests/Doc/CmdsStringExample.cs
@@ -15,7 +15,6 @@ namespace Doc;
public class CmdsStringExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/Cms_tutorial.cs b/tests/Doc/Cms_tutorial.cs
index ae97bf0b..e92aa4b4 100644
--- a/tests/Doc/Cms_tutorial.cs
+++ b/tests/Doc/Cms_tutorial.cs
@@ -17,7 +17,6 @@ namespace Doc;
public class Cms_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/Cuckoo_tutorial.cs b/tests/Doc/Cuckoo_tutorial.cs
index dd469cda..826cb5cf 100644
--- a/tests/Doc/Cuckoo_tutorial.cs
+++ b/tests/Doc/Cuckoo_tutorial.cs
@@ -16,7 +16,6 @@ namespace Doc;
public class Cuckoo_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/Geo_tutorial.cs b/tests/Doc/Geo_tutorial.cs
index 94acb9cc..576f533d 100644
--- a/tests/Doc/Geo_tutorial.cs
+++ b/tests/Doc/Geo_tutorial.cs
@@ -15,7 +15,6 @@ namespace Doc;
public class Geo_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/HashExample.cs b/tests/Doc/HashExample.cs
index 10c108cd..3f80b696 100644
--- a/tests/Doc/HashExample.cs
+++ b/tests/Doc/HashExample.cs
@@ -10,7 +10,7 @@ namespace Doc;
//REMOVE_END
public class HashExample
{
- [SkipIfRedis(Is.OSSCluster)]
+
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/Hll_tutorial.cs b/tests/Doc/Hll_tutorial.cs
index cf7a1ed5..97409432 100644
--- a/tests/Doc/Hll_tutorial.cs
+++ b/tests/Doc/Hll_tutorial.cs
@@ -15,7 +15,6 @@ namespace Doc;
public class Hll_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/HomeJsonExample.cs b/tests/Doc/HomeJsonExample.cs
index b404469d..0132f75e 100644
--- a/tests/Doc/HomeJsonExample.cs
+++ b/tests/Doc/HomeJsonExample.cs
@@ -19,7 +19,6 @@ namespace Doc;
public class HomeJsonExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
// STEP_START connect
diff --git a/tests/Doc/Json_tutorial.cs b/tests/Doc/Json_tutorial.cs
index 1d5f797a..59ebac6a 100644
--- a/tests/Doc/Json_tutorial.cs
+++ b/tests/Doc/Json_tutorial.cs
@@ -17,7 +17,6 @@ namespace Doc;
public class Json_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/ListTutorial.cs b/tests/Doc/ListTutorial.cs
index 3c362edb..79ee0135 100644
--- a/tests/Doc/ListTutorial.cs
+++ b/tests/Doc/ListTutorial.cs
@@ -13,9 +13,6 @@ namespace Doc;
//REMOVE_END
public class ListExample
{
- //REMOVE_START
- [SkipIfRedis(Is.OSSCluster)]
- //REMOVE_END
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/QueryAggExample.cs b/tests/Doc/QueryAggExample.cs
index ec5f696d..2364fdfd 100644
--- a/tests/Doc/QueryAggExample.cs
+++ b/tests/Doc/QueryAggExample.cs
@@ -19,7 +19,6 @@ namespace Doc;
public class QueryAggExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/QueryEmExample.cs b/tests/Doc/QueryEmExample.cs
index 590a212d..3e1b7f33 100644
--- a/tests/Doc/QueryEmExample.cs
+++ b/tests/Doc/QueryEmExample.cs
@@ -18,7 +18,6 @@ namespace Doc;
public class QueryEmExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/QueryFtExample.cs b/tests/Doc/QueryFtExample.cs
index bc7f544b..350b4eaa 100644
--- a/tests/Doc/QueryFtExample.cs
+++ b/tests/Doc/QueryFtExample.cs
@@ -18,7 +18,6 @@ namespace Doc;
public class QueryFtExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/QueryRangeExample.cs b/tests/Doc/QueryRangeExample.cs
index 44755930..cdc6d83f 100644
--- a/tests/Doc/QueryRangeExample.cs
+++ b/tests/Doc/QueryRangeExample.cs
@@ -18,7 +18,6 @@ namespace Doc;
public class QueryRangeExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/SearchQuickstartExample.cs b/tests/Doc/SearchQuickstartExample.cs
index c7a1f5b9..a683b488 100644
--- a/tests/Doc/SearchQuickstartExample.cs
+++ b/tests/Doc/SearchQuickstartExample.cs
@@ -13,7 +13,7 @@ namespace Doc;
// REMOVE_END
public class SearchQuickstartExample
{
- [SkipIfRedis(Is.OSSCluster)]
+
public void run()
{
// STEP_START connect
diff --git a/tests/Doc/SetGetExample.cs b/tests/Doc/SetGetExample.cs
index 3d9af1e2..84f8406a 100644
--- a/tests/Doc/SetGetExample.cs
+++ b/tests/Doc/SetGetExample.cs
@@ -11,7 +11,6 @@ namespace Doc;
public class SetGetExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var redis = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/SetsTutorial.cs b/tests/Doc/SetsTutorial.cs
index 916b9f0b..671c1a98 100644
--- a/tests/Doc/SetsTutorial.cs
+++ b/tests/Doc/SetsTutorial.cs
@@ -16,7 +16,6 @@ namespace Doc;
public class SetsExample
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/SortedSetExample.cs b/tests/Doc/SortedSetExample.cs
index d7771d58..5dce4136 100644
--- a/tests/Doc/SortedSetExample.cs
+++ b/tests/Doc/SortedSetExample.cs
@@ -11,9 +11,7 @@ namespace Doc;
//REMOVE_END
public class SortedSetExample
{
- //REMOVE_START
- [SkipIfRedis(Is.OSSCluster)]
- //REMOVE_END
+
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/StreamTutorial.cs b/tests/Doc/StreamTutorial.cs
index d1bf89f8..8619ead6 100644
--- a/tests/Doc/StreamTutorial.cs
+++ b/tests/Doc/StreamTutorial.cs
@@ -16,7 +16,6 @@ namespace Doc;
public class StreamTutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/StringSnippets.cs b/tests/Doc/StringSnippets.cs
index c7f3bade..d2f8ea24 100644
--- a/tests/Doc/StringSnippets.cs
+++ b/tests/Doc/StringSnippets.cs
@@ -11,9 +11,6 @@ namespace Doc;
//REMOVE_END
public class StringSnippets
{
- //REMOVE_START
- [SkipIfRedis(Is.OSSCluster)]
- //REMOVE_END
public void run()
{
var redis = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/Tdigest_tutorial.cs b/tests/Doc/Tdigest_tutorial.cs
index b56e237f..44ba47c5 100644
--- a/tests/Doc/Tdigest_tutorial.cs
+++ b/tests/Doc/Tdigest_tutorial.cs
@@ -16,7 +16,6 @@ namespace Doc;
public class Tdigest_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/Doc/Topk_tutorial.cs b/tests/Doc/Topk_tutorial.cs
index ce583cf2..b364d47e 100644
--- a/tests/Doc/Topk_tutorial.cs
+++ b/tests/Doc/Topk_tutorial.cs
@@ -16,7 +16,6 @@ namespace Doc;
public class Topk_tutorial
{
- [SkipIfRedis(Is.OSSCluster)]
public void run()
{
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
diff --git a/tests/NRedisStack.Tests/AbstractNRedisStackTest.cs b/tests/NRedisStack.Tests/AbstractNRedisStackTest.cs
index e51aa449..77ec122c 100644
--- a/tests/NRedisStack.Tests/AbstractNRedisStackTest.cs
+++ b/tests/NRedisStack.Tests/AbstractNRedisStackTest.cs
@@ -1,14 +1,62 @@
using NRedisStack.DataTypes;
using System.Runtime.CompilerServices;
+using StackExchange.Redis;
using Xunit;
namespace NRedisStack.Tests;
-public abstract class AbstractNRedisStackTest : IClassFixture, IAsyncLifetime
+public abstract class AbstractNRedisStackTest : IClassFixture, IAsyncLifetime
{
- protected internal RedisFixture redisFixture;
+ protected internal EndpointsFixture EndpointsFixture;
- protected internal AbstractNRedisStackTest(RedisFixture redisFixture) => this.redisFixture = redisFixture;
+ protected readonly ConfigurationOptions DefaultConnectionConfig = new()
+ {
+ AsyncTimeout = 10000,
+ SyncTimeout = 10000,
+ AllowAdmin = true,
+ };
+
+ protected internal AbstractNRedisStackTest(EndpointsFixture endpointsFixture)
+ {
+ this.EndpointsFixture = endpointsFixture;
+ }
+
+ protected ConnectionMultiplexer GetConnection(string endpointId = EndpointsFixture.Env.Standalone) => EndpointsFixture.GetConnectionById(this.DefaultConnectionConfig, endpointId);
+
+ protected ConnectionMultiplexer GetConnection(ConfigurationOptions configurationOptions, string endpointId = EndpointsFixture.Env.Standalone) => EndpointsFixture.GetConnectionById(configurationOptions, endpointId);
+
+ protected IDatabase GetDatabase(string endpointId = EndpointsFixture.Env.Standalone)
+ {
+ var redis = GetConnection(endpointId);
+ IDatabase db = redis.GetDatabase();
+ return db;
+ }
+
+ protected IDatabase GetCleanDatabase(string endpointId = EndpointsFixture.Env.Standalone)
+ {
+ var redis = GetConnection(endpointId);
+
+ if (endpointId == EndpointsFixture.Env.Cluster)
+ {
+ foreach (var endPoint in redis.GetEndPoints())
+ {
+ var server = redis.GetServer(endPoint);
+
+ if (server.IsReplica) continue;
+
+ server.Execute("FLUSHALL");
+ }
+ }
+
+ IDatabase db = redis.GetDatabase();
+ db.Execute("FLUSHALL");
+ return db;
+ }
+
+ protected void SkipIfTargetConnectionDoesNotExist(string id)
+ {
+ Skip.IfNot(EndpointsFixture.IsTargetConnectionExist(id), $"The connection with id '{id}' is not configured.");
+ }
private List keyNames = new List();
@@ -44,13 +92,13 @@ protected internal static List ReverseData(List (RedisKey)i).ToArray());
- await redis.ExecuteBroadcastAsync("FLUSHALL");
+ //await redis.ExecuteBroadcastAsync("FLUSHALL");
}
}
\ No newline at end of file
diff --git a/tests/NRedisStack.Tests/Bloom/BloomTests.cs b/tests/NRedisStack.Tests/Bloom/BloomTests.cs
index 2198f03b..a9c684b1 100644
--- a/tests/NRedisStack.Tests/Bloom/BloomTests.cs
+++ b/tests/NRedisStack.Tests/Bloom/BloomTests.cs
@@ -7,15 +7,17 @@ namespace NRedisStack.Tests.Bloom;
public class BloomTests : AbstractNRedisStackTest, IDisposable
{
private readonly string key = "BLOOM_TESTS";
- public BloomTests(RedisFixture redisFixture) : base(redisFixture) { }
- [Fact]
- public void TestReserveBasic()
+ public BloomTests(EndpointsFixture endpointsFixture) : base(endpointsFixture)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
- var bf = db.BF();
+ }
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestReserveBasic(string endpointId)
+ {
+ IDatabase db = GetCleanDatabase(endpointId);
+ var bf = db.BF();
bf.Reserve(key, 0.001, 100L);
@@ -24,11 +26,11 @@ public void TestReserveBasic()
Assert.False(bf.Exists(key, "item2"));
}
- [Fact]
- public async Task TestReserveBasicAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestReserveBasicAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
await bf.ReserveAsync(key, 0.001, 100L);
@@ -38,58 +40,55 @@ public async Task TestReserveBasicAsync()
Assert.False(await bf.ExistsAsync(key, "item2"));
}
- [Fact]
- public void TestAddWhenExist()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestAddWhenExist(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
Assert.True((bf.Add(key, "item1"))); // first time
Assert.False(bf.Add(key, "item1")); // second time
}
- [Fact]
- public async Task TestAddWhenExistAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestAddWhenExistAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
-
Assert.True(await bf.AddAsync(key, "item1")); // first time
Assert.False(await bf.AddAsync(key, "item1")); // second time
}
- [Fact]
- public void TestAddExists()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestAddExists(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
-
bf.Add(key, "item1");
Assert.True(bf.Exists(key, "item1"));
}
- [Fact]
- public async Task TestAddExistsAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestAddExistsAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
-
await bf.AddAsync(key, "item1");
Assert.True(await bf.ExistsAsync(key, "item1"));
}
- [Fact]
- public void TestAddExistsMulti()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestAddExistsMulti(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
var items = new RedisValue[] { "foo", "bar", "baz" };
var items2 = new RedisValue[] { "newElement", "bar", "baz" };
@@ -101,11 +100,11 @@ public void TestAddExistsMulti()
Assert.Equal(new bool[] { true, false, false }, result);
}
- [Fact]
- public async Task TestAddExistsMultiAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestAddExistsMultiAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
var items = new RedisValue[] { "foo", "bar", "baz" };
var items2 = new RedisValue[] { "newElement", "bar", "baz" };
@@ -117,11 +116,11 @@ public async Task TestAddExistsMultiAsync()
Assert.Equal(new bool[] { true, false, false }, result);
}
- [Fact]
- public void TestExample()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestExample(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
// Simple bloom filter using default module settings
@@ -146,11 +145,11 @@ public void TestExample()
bf.Add("specialBloom", "foo");
}
- [Fact]
- public async Task TestExampleAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestExampleAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
// Simple bloom filter using default module settings
@@ -175,11 +174,11 @@ public async Task TestExampleAsync()
await bf.AddAsync("specialBloom", "foo");
}
- [Fact]
- public void TestInsert()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestInsert(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
RedisValue[] items = new RedisValue[] { "item1", "item2", "item3" };
@@ -191,11 +190,11 @@ public void TestInsert()
Assert.True(bf.Exists("key", "item3"));
}
- [Fact]
- public async Task TestInsertAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestInsertAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
RedisValue[] items = new RedisValue[] { "item1", "item2", "item3" };
@@ -207,33 +206,33 @@ public async Task TestInsertAsync()
Assert.True(await bf.ExistsAsync("key", "item3"));
}
- [Fact]
- public void TestExistsNonExist()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestExistsNonExist(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
RedisValue item = new RedisValue("item");
Assert.False(bf.Exists("NonExistKey", item));
}
- [Fact]
- public async Task TestExistsNonExistAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestExistsNonExistAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
RedisValue item = new RedisValue("item");
Assert.False(await bf.ExistsAsync("NonExistKey", item));
}
- [Fact]
- public void TestInfo()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestInfo(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
bf.Add(key, "item");
@@ -245,11 +244,11 @@ public void TestInfo()
Assert.Throws(() => bf.Info("notExistKey"));
}
- [Fact]
- public async Task TestInfoAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestInfoAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
await bf.AddAsync(key, "item");
@@ -261,11 +260,11 @@ public async Task TestInfoAsync()
await Assert.ThrowsAsync(() => bf.InfoAsync("notExistKey"));
}
- [Fact]
- public void TestScanDumpAndLoadChunk()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestScanDumpAndLoadChunk(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
bf.Reserve("bloom-dump", 0.1, 10);
@@ -286,11 +285,11 @@ public void TestScanDumpAndLoadChunk()
Assert.True(bf.Exists("bloom-load", "a"));
}
- [Fact]
- public async Task TestScanDumpAndLoadChunkAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestScanDumpAndLoadChunkAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
await bf.ReserveAsync("bloom-dump", 0.1, 10);
@@ -311,12 +310,13 @@ public async Task TestScanDumpAndLoadChunkAsync()
Assert.True(await bf.ExistsAsync("bloom-load", "a"));
}
-
- [Fact]
- public void TestModulePrefixs()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestModulePrefixs(string endpointId)
{
- IDatabase db1 = redisFixture.Redis.GetDatabase();
- IDatabase db2 = redisFixture.Redis.GetDatabase();
+ var redis = GetConnection(endpointId);
+ IDatabase db1 = redis.GetDatabase();
+ IDatabase db2 = redis.GetDatabase();
var bf1 = db1.FT();
var bf2 = db2.FT();
@@ -324,11 +324,11 @@ public void TestModulePrefixs()
Assert.NotEqual(bf1.GetHashCode(), bf2.GetHashCode());
}
- [Fact]
- public void TestCard()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestCard(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
// return 0 if the key does not exist:
@@ -343,11 +343,11 @@ public void TestCard()
Assert.Throws(() => bf.Card("setKey"));
}
- [Fact]
- public async Task TestCardAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestCardAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
// return 0 if the key does not exist:
@@ -362,11 +362,11 @@ public async Task TestCardAsync()
await Assert.ThrowsAsync(() => bf.CardAsync("setKey"));
}
- [Fact]
- public void TestInsertArgsError()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestInsertArgsError(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
var bf = db.BF();
RedisValue[] items = new RedisValue[] { "item1", "item2", "item3" };
diff --git a/tests/NRedisStack.Tests/Core Commands/CoreTests.cs b/tests/NRedisStack.Tests/Core Commands/CoreTests.cs
index cf330786..8088e88f 100644
--- a/tests/NRedisStack.Tests/Core Commands/CoreTests.cs
+++ b/tests/NRedisStack.Tests/Core Commands/CoreTests.cs
@@ -10,14 +10,16 @@ namespace NRedisStack.Tests.Core;
public class CoreTests : AbstractNRedisStackTest, IDisposable
{
- public CoreTests(RedisFixture redisFixture) : base(redisFixture) { }
+ public CoreTests(EndpointsFixture endpointsFixture) : base(endpointsFixture)
+ {
+ }
// TODO: understand why this test fails on enterprise
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.1.242")]
- public void TestSimpleSetInfo()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.1.242")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestSimpleSetInfo(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
db.ClientSetInfo(SetInfoAttr.LibraryName, "TestLibraryName");
db.ClientSetInfo(SetInfoAttr.LibraryVersion, "1.2.3");
@@ -26,11 +28,11 @@ public void TestSimpleSetInfo()
Assert.EndsWith($"lib-name=TestLibraryName lib-ver=1.2.3\n", info);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.1.242")]
- public async Task TestSimpleSetInfoAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.1.242")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestSimpleSetInfoAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
await db.ClientSetInfoAsync(SetInfoAttr.LibraryName, "TestLibraryName");
await db.ClientSetInfoAsync(SetInfoAttr.LibraryVersion, "1.2.3");
@@ -39,12 +41,12 @@ public async Task TestSimpleSetInfoAsync()
Assert.EndsWith($"lib-name=TestLibraryName lib-ver=1.2.3\n", info);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.1.242")]
- public void TestSetInfoDefaultValue()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.1.242")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestSetInfoDefaultValue(string endpointId)
{
ResetInfoDefaults(); // demonstrate first connection
- var db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
db.Execute(new SerializedCommand("PING")); // only the extension method of Execute (which is used for all the commands of Redis Stack) will set the library name and version.
@@ -52,12 +54,12 @@ public void TestSetInfoDefaultValue()
Assert.EndsWith($"lib-name=NRedisStack(.NET_v{Environment.Version}) lib-ver={GetNRedisStackVersion()}\n", info);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.1.242")]
- public async Task TestSetInfoDefaultValueAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.1.242")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestSetInfoDefaultValueAsync(string endpointId)
{
ResetInfoDefaults(); // demonstrate first connection
- var db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
await db.ExecuteAsync(new SerializedCommand("PING")); // only the extension method of Execute (which is used for all the commands of Redis Stack) will set the library name and version.
@@ -65,12 +67,12 @@ public async Task TestSetInfoDefaultValueAsync()
Assert.EndsWith($"lib-name=NRedisStack(.NET_v{Environment.Version}) lib-ver={GetNRedisStackVersion()}\n", info);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.1.242")]
- public void TestSetInfoWithValue()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.1.242")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestSetInfoWithValue(string endpointId)
{
ResetInfoDefaults(); // demonstrate first connection
- var db = redisFixture.Redis.GetDatabase("MyLibraryName;v1.0.0");
- db.Execute("FLUSHALL");
+ var db = GetConnection(endpointId).GetDatabase("MyLibraryName;v1.0.0");
db.Execute(new SerializedCommand("PING")); // only the extension method of Execute (which is used for all the commands of Redis Stack) will set the library name and version.
@@ -78,12 +80,12 @@ public void TestSetInfoWithValue()
Assert.EndsWith($"NRedisStack(MyLibraryName;v1.0.0;.NET_v{Environment.Version}) lib-ver={GetNRedisStackVersion()}\n", info);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.1.242")]
- public async Task TestSetInfoWithValueAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.1.242")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestSetInfoWithValueAsync(string endpointId)
{
ResetInfoDefaults(); // demonstrate first connection
- var db = redisFixture.Redis.GetDatabase("MyLibraryName;v1.0.0");
- db.Execute("FLUSHALL");
+ var db = GetConnection(endpointId).GetDatabase("MyLibraryName;v1.0.0");
await db.ExecuteAsync(new SerializedCommand("PING")); // only the extension method of Execute (which is used for all the commands of Redis Stack) will set the library name and version.
@@ -91,13 +93,13 @@ public async Task TestSetInfoWithValueAsync()
Assert.EndsWith($"NRedisStack(MyLibraryName;v1.0.0;.NET_v{Environment.Version}) lib-ver={GetNRedisStackVersion()}\n", info);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.1.242")]
- public void TestSetInfoNull()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.1.242")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestSetInfoNull(string endpointId)
{
ResetInfoDefaults(); // demonstrate first connection
- var db = redisFixture.Redis.GetDatabase(null);
+ var db = GetConnection(endpointId).GetDatabase(null);
- db.Execute("FLUSHALL");
var infoBefore = db.Execute("CLIENT", "INFO").ToString();
db.Execute(new SerializedCommand("PING")); // only the extension method of Execute (which is used for all the commands of Redis Stack) will set the library name and version.
@@ -114,13 +116,13 @@ public void TestSetInfoNull()
Assert.Equal(infoAfterLibNameToEnd, infoBeforeLibNameToEnd);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.1.242")]
- public async Task TestSetInfoNullAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.1.242")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestSetInfoNullAsync(string endpointId)
{
ResetInfoDefaults(); // demonstrate first connection
- var db = redisFixture.Redis.GetDatabase(null);
+ var db = GetConnection(endpointId).GetDatabase(null);
- db.Execute("FLUSHALL");
var infoBefore = (await db.ExecuteAsync("CLIENT", "INFO")).ToString();
await db.ExecuteAsync(new SerializedCommand("PING")); // only the extension method of Execute (which is used for all the commands of Redis Stack) will set the library name and version.
@@ -137,11 +139,11 @@ public async Task TestSetInfoNullAsync()
Assert.Equal(infoAfterLibNameToEnd, infoBeforeLibNameToEnd);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBZMPop()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZMPop(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var sortedSetKey = "my-set";
@@ -169,11 +171,11 @@ public void TestBZMPop()
Assert.Equal("d", resultWithDescendingOrder.Item2[0].Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public async Task TestBZMPopAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZMPopAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var sortedSetKey = "my-set";
@@ -201,11 +203,11 @@ public async Task TestBZMPopAsync()
Assert.Equal("d", resultWithDescendingOrder.Item2[0].Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBZMPopNull()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZMPopNull(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = db.BZMPop(0.5, "my-set", MinMaxModifier.Min, null);
@@ -213,11 +215,11 @@ public void TestBZMPopNull()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public async Task TestBZMPopNullAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZMPopNullAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = await db.BZMPopAsync(0.5, "my-set", MinMaxModifier.Min, null);
@@ -225,13 +227,14 @@ public async Task TestBZMPopNullAsync()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBZMPopMultiplexerTimeout()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZMPopMultiplexerTimeout(string endpointId)
{
var configurationOptions = new ConfigurationOptions();
configurationOptions.SyncTimeout = 1000;
- using var redis = redisFixture.GetConnectionById(configurationOptions, "standalone");
+ using var redis = GetConnection(configurationOptions, endpointId);
var db = redis.GetDatabase(null);
db.Execute("FLUSHALL");
@@ -240,13 +243,14 @@ public void TestBZMPopMultiplexerTimeout()
Assert.Throws(() => db.BZMPop(0, "my-set", MinMaxModifier.Min));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public async Task TestBZMPopMultiplexerTimeoutAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZMPopMultiplexerTimeoutAsync(string endpointId)
{
var configurationOptions = new ConfigurationOptions();
configurationOptions.SyncTimeout = 1000;
- await using var redis = redisFixture.GetConnectionById(configurationOptions, "standalone");
+ await using var redis = GetConnection(configurationOptions, endpointId);
var db = redis.GetDatabase(null);
db.Execute("FLUSHALL");
@@ -255,11 +259,11 @@ public async Task TestBZMPopMultiplexerTimeoutAsync()
await Assert.ThrowsAsync(async () => await db.BZMPopAsync(0, "my-set", MinMaxModifier.Min));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBZMPopMultipleSets()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZMPopMultipleSets(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.SortedSetAdd("set-one", "a", 1.5);
db.SortedSetAdd("set-one", "b", 5.1);
@@ -297,11 +301,11 @@ public void TestBZMPopMultipleSets()
Assert.Equal("c", result.Item2[1].Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public async Task TestBZMPopMultipleSetsAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZMPopMultipleSetsAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.SortedSetAdd("set-one", "a", 1.5);
db.SortedSetAdd("set-one", "b", 5.1);
@@ -339,20 +343,20 @@ public async Task TestBZMPopMultipleSetsAsync()
Assert.Equal("c", result.Item2[1].Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBZMPopNoKeysProvided()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZMPopNoKeysProvided(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
Assert.Throws(() => db.BZMPop(0, Array.Empty(), MinMaxModifier.Min));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBZMPopWithOrderEnum()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZMPopWithOrderEnum(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var sortedSetKey = "my-set-" + Guid.NewGuid();
@@ -377,11 +381,11 @@ public void TestBZMPopWithOrderEnum()
Assert.Equal("b", resultWithDescendingOrder.Item2[0].Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestBZPopMin()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZPopMin(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var sortedSetKey = "my-set";
@@ -396,11 +400,11 @@ public void TestBZPopMin()
Assert.Equal(1.5, result.Item2.Score);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestBZPopMinAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZPopMinAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var sortedSetKey = "my-set";
@@ -415,11 +419,11 @@ public async Task TestBZPopMinAsync()
Assert.Equal(1.5, result.Item2.Score);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestBZPopMinNull()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZPopMinNull(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = db.BZPopMin("my-set", 0.5);
@@ -427,11 +431,11 @@ public void TestBZPopMinNull()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestBZPopMinNullAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZPopMinNullAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = await db.BZPopMinAsync("my-set", 0.5);
@@ -439,11 +443,11 @@ public async Task TestBZPopMinNullAsync()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestBZPopMinMultipleSets()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZPopMinMultipleSets(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.SortedSetAdd("set-one", "a", 1.5);
db.SortedSetAdd("set-one", "b", 5.1);
@@ -462,11 +466,11 @@ public void TestBZPopMinMultipleSets()
Assert.Equal("a", result.Item2.Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestBZPopMinMultipleSetsAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZPopMinMultipleSetsAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.SortedSetAdd("set-one", "a", 1.5);
db.SortedSetAdd("set-one", "b", 5.1);
@@ -485,11 +489,11 @@ public async Task TestBZPopMinMultipleSetsAsync()
Assert.Equal("a", result.Item2.Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestBZPopMax()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZPopMax(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var sortedSetKey = "my-set";
@@ -504,11 +508,11 @@ public void TestBZPopMax()
Assert.Equal(5.1, result.Item2.Score);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestBZPopMaxAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZPopMaxAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var sortedSetKey = "my-set";
@@ -523,11 +527,11 @@ public async Task TestBZPopMaxAsync()
Assert.Equal(5.1, result.Item2.Score);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestBZPopMaxNull()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZPopMaxNull(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = db.BZPopMax("my-set", 0.5);
@@ -535,11 +539,11 @@ public void TestBZPopMaxNull()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestBZPopMaxNullAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZPopMaxNullAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = await db.BZPopMaxAsync("my-set", 0.5);
@@ -547,11 +551,11 @@ public async Task TestBZPopMaxNullAsync()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestBZPopMaxMultipleSets()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBZPopMaxMultipleSets(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.SortedSetAdd("set-one", "a", 1.5);
db.SortedSetAdd("set-one", "b", 5.1);
@@ -570,11 +574,11 @@ public void TestBZPopMaxMultipleSets()
Assert.Equal("b", result.Item2.Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestBZPopMaxMultipleSetsAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBZPopMaxMultipleSetsAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.SortedSetAdd("set-one", "a", 1.5);
db.SortedSetAdd("set-one", "b", 5.1);
@@ -593,11 +597,11 @@ public async Task TestBZPopMaxMultipleSetsAsync()
Assert.Equal("b", result.Item2.Value.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBLMPop()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBLMPop(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("my-list", "a");
db.ListRightPush("my-list", "b");
@@ -623,11 +627,11 @@ public void TestBLMPop()
Assert.Equal("e", resultWithDescendingOrder.Item2[0].ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public async Task TestBLMPopAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBLMPopAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("my-list", "a");
db.ListRightPush("my-list", "b");
@@ -653,11 +657,11 @@ public async Task TestBLMPopAsync()
Assert.Equal("e", resultWithDescendingOrder.Item2[0].ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBLMPopNull()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBLMPopNull(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the list, and a short server timeout, which yields null.
var result = db.BLMPop(0.5, "my-list", ListSide.Left);
@@ -665,11 +669,11 @@ public void TestBLMPopNull()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public async Task TestBLMPopNullAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBLMPopNullAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the list, and a short server timeout, which yields null.
var result = await db.BLMPopAsync(0.5, "my-list", ListSide.Left);
@@ -677,11 +681,11 @@ public async Task TestBLMPopNullAsync()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBLMPopMultipleLists()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBLMPopMultipleLists(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -719,11 +723,11 @@ public void TestBLMPopMultipleLists()
Assert.Equal("b", result.Item2[1].ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public async Task TestBLMPopMultipleListsAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBLMPopMultipleListsAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -761,20 +765,20 @@ public async Task TestBLMPopMultipleListsAsync()
Assert.Equal("b", result.Item2[1].ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "7.0.0")]
- public void TestBLMPopNoKeysProvided()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "7.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBLMPopNoKeysProvided(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
Assert.Throws(() => db.BLMPop(0, Array.Empty(), ListSide.Left));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public void TestBLPop()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBLPop(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("my-list", "a");
db.ListRightPush("my-list", "b");
@@ -786,11 +790,11 @@ public void TestBLPop()
Assert.Equal("a", result.Item2.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public async Task TestBLPopAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBLPopAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("my-list", "a");
db.ListRightPush("my-list", "b");
@@ -802,11 +806,11 @@ public async Task TestBLPopAsync()
Assert.Equal("a", result.Item2.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public void TestBLPopNull()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBLPopNull(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = db.BLPop("my-set", 0.5);
@@ -814,11 +818,11 @@ public void TestBLPopNull()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public async Task TestBLPopNullAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBLPopNullAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = await db.BLPopAsync("my-set", 0.5);
@@ -826,11 +830,11 @@ public async Task TestBLPopNullAsync()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public void TestBLPopMultipleLists()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBLPopMultipleLists(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -849,11 +853,11 @@ public void TestBLPopMultipleLists()
Assert.Equal("a", result.Item2.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public async Task TestBLPopMultipleListsAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBLPopMultipleListsAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -872,11 +876,11 @@ public async Task TestBLPopMultipleListsAsync()
Assert.Equal("a", result.Item2.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public void TestBRPop()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBRPop(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("my-list", "a");
db.ListRightPush("my-list", "b");
@@ -888,11 +892,11 @@ public void TestBRPop()
Assert.Equal("b", result.Item2.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public async Task TestBRPopAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBRPopAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("my-list", "a");
db.ListRightPush("my-list", "b");
@@ -904,11 +908,11 @@ public async Task TestBRPopAsync()
Assert.Equal("b", result.Item2.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public void TestBRPopNull()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBRPopNull(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = db.BRPop("my-set", 0.5);
@@ -916,11 +920,11 @@ public void TestBRPopNull()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public async Task TestBRPopNullAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBRPopNullAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
// Nothing in the set, and a short server timeout, which yields null.
var result = await db.BRPopAsync("my-set", 0.5);
@@ -928,11 +932,11 @@ public async Task TestBRPopNullAsync()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public void TestBRPopMultipleLists()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBRPopMultipleLists(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -951,11 +955,11 @@ public void TestBRPopMultipleLists()
Assert.Equal("b", result.Item2.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.0.0")]
- public async Task TestBRPopMultipleListsAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBRPopMultipleListsAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -974,11 +978,11 @@ public async Task TestBRPopMultipleListsAsync()
Assert.Equal("b", result.Item2.ToString());
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "6.2.0")]
- public void TestBLMove()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "6.2.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBLMove(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -1031,11 +1035,11 @@ public void TestBLMove()
Assert.Equal("c", db.ListGetByIndex("list-two", 1));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "6.2.0")]
- public async Task TestBLMoveAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "6.2.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBLMoveAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -1088,11 +1092,11 @@ public async Task TestBLMoveAsync()
Assert.Equal("c", db.ListGetByIndex("list-two", 1));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.2.0")]
- public void TestBRPopLPush()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.2.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestBRPopLPush(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -1109,11 +1113,11 @@ public void TestBRPopLPush()
Assert.Equal("b", db.ListLeftPop("list-two"));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "2.2.0")]
- public async Task TestBRPopLPushAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "2.2.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestBRPopLPushAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.ListRightPush("list-one", "a");
db.ListRightPush("list-one", "b");
@@ -1130,11 +1134,11 @@ public async Task TestBRPopLPushAsync()
Assert.Equal("b", db.ListLeftPop("list-two"));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXRead()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXRead(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.StreamAdd("my-stream", "a", 1);
db.StreamAdd("my-stream", "b", 7);
@@ -1162,11 +1166,11 @@ public void TestXRead()
Assert.Equal(7, streamEntry.Values[0].Value);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestXReadAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestXReadAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.StreamAdd("my-stream", "a", 1);
db.StreamAdd("my-stream", "b", 7);
@@ -1194,11 +1198,11 @@ public async Task TestXReadAsync()
Assert.Equal(7, streamEntry.Values[0].Value);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadMultipleStreams()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadMultipleStreams(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.StreamAdd("stream-one", "a", 1);
db.StreamAdd("stream-one", "b", 7);
@@ -1244,11 +1248,11 @@ public void TestXReadMultipleStreams()
Assert.Equal("bar", result![1].Entries[0].Values[0].Value);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestXReadMultipleStreamsAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestXReadMultipleStreamsAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.StreamAdd("stream-one", "a", 1);
db.StreamAdd("stream-one", "b", 7);
@@ -1292,11 +1296,11 @@ public async Task TestXReadMultipleStreamsAsync()
Assert.Equal("bar", result![1].Entries[0].Values[0].Value);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadOnlyNewMessages()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadOnlyNewMessages(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.StreamAdd("my-stream", "a", 1);
@@ -1307,11 +1311,11 @@ public void TestXReadOnlyNewMessages()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestXReadOnlyNewMessagesAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestXReadOnlyNewMessagesAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
db.StreamAdd("my-stream", "a", 1);
@@ -1322,31 +1326,31 @@ public async Task TestXReadOnlyNewMessagesAsync()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadNoKeysProvided()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadNoKeysProvided(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
Assert.Throws(() => db.XRead(Array.Empty(),
new RedisValue[] { StreamSpecialIds.NewMessagesId }));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadMismatchedKeysAndPositionsCountsProvided()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadMismatchedKeysAndPositionsCountsProvided(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
Assert.Throws(() => db.XRead(new RedisKey[] { "my-stream" },
new RedisValue[] { StreamSpecialIds.NewMessagesId, StreamSpecialIds.NewMessagesId }));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadGroup()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadGroup(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var groupCreationResult = db.StreamCreateConsumerGroup("my-stream", "my-group");
Assert.True(groupCreationResult);
@@ -1442,11 +1446,11 @@ public void TestXReadGroup()
Assert.Empty(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestXReadGroupAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestXReadGroupAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var groupCreationResult = db.StreamCreateConsumerGroup("my-stream", "my-group");
Assert.True(groupCreationResult);
@@ -1542,11 +1546,11 @@ public async Task TestXReadGroupAsync()
Assert.Empty(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadGroupNoAck()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadGroupNoAck(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var groupCreationResult = db.StreamCreateConsumerGroup("my-stream", "my-group");
Assert.True(groupCreationResult);
@@ -1575,11 +1579,11 @@ public void TestXReadGroupNoAck()
Assert.Empty(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadGroupMultipleStreams()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadGroupMultipleStreams(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var groupCreationResult = db.StreamCreateConsumerGroup("stream-one", "my-group");
Assert.True(groupCreationResult);
@@ -1629,11 +1633,11 @@ public void TestXReadGroupMultipleStreams()
Assert.Equal(17, result![1].Entries[0].Values[0].Value);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestXReadGroupMultipleStreamsAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestXReadGroupMultipleStreamsAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var groupCreationResult = db.StreamCreateConsumerGroup("stream-one", "my-group");
Assert.True(groupCreationResult);
@@ -1683,11 +1687,11 @@ public async Task TestXReadGroupMultipleStreamsAsync()
Assert.Equal(17, result![1].Entries[0].Values[0].Value);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadGroupNull()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadGroupNull(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var groupCreationResult = db.StreamCreateConsumerGroup("my-stream", "my-group");
Assert.True(groupCreationResult);
@@ -1699,11 +1703,11 @@ public void TestXReadGroupNull()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public async Task TestXReadGroupNullAsync()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestXReadGroupNullAsync(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var groupCreationResult = db.StreamCreateConsumerGroup("my-stream", "my-group");
Assert.True(groupCreationResult);
@@ -1715,21 +1719,21 @@ public async Task TestXReadGroupNullAsync()
Assert.Null(result);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadGroupNoKeysProvided()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadGroupNoKeysProvided(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
Assert.Throws(() => db.XReadGroup("my-group", "consumer",
Array.Empty(), new RedisValue[] { StreamSpecialIds.NewMessagesId }));
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise, Comparison.LessThan, "5.0.0")]
- public void TestXReadGroupMismatchedKeysAndPositionsCountsProvided()
+ [SkipIfRedis(Is.Enterprise, Comparison.LessThan, "5.0.0")]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestXReadGroupMismatchedKeysAndPositionsCountsProvided(string endpointId)
{
- var db = redisFixture.Redis.GetDatabase(null);
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
Assert.Throws(() => db.XReadGroup("my-group", "consumer",
new RedisKey[] { "my-stream" }, new RedisValue[] { StreamSpecialIds.NewMessagesId, StreamSpecialIds.NewMessagesId }));
diff --git a/tests/NRedisStack.Tests/CountMinSketch/CmsTests.cs b/tests/NRedisStack.Tests/CountMinSketch/CmsTests.cs
index 5463725d..76ac586b 100644
--- a/tests/NRedisStack.Tests/CountMinSketch/CmsTests.cs
+++ b/tests/NRedisStack.Tests/CountMinSketch/CmsTests.cs
@@ -7,14 +7,17 @@ namespace NRedisStack.Tests.CuckooFilter;
public class CmsTests : AbstractNRedisStackTest, IDisposable
{
private readonly string key = "CMS_TESTS";
- public CmsTests(RedisFixture redisFixture) : base(redisFixture) { }
+
+ public CmsTests(EndpointsFixture endpointsFixture) : base(endpointsFixture)
+ {
+ }
- [Fact]
- public void TestInitByDim()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestInitByDim(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
cms.InitByDim(key, 16, 4);
@@ -25,11 +28,11 @@ public void TestInitByDim()
Assert.Equal(0, info.Count);
}
- [Fact]
- public async Task TestInitByDimAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestInitByDimAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
await cms.InitByDimAsync(key, 16, 4);
@@ -40,11 +43,11 @@ public async Task TestInitByDimAsync()
Assert.Equal(0, info.Count);
}
- [Fact]
- public void TestInitByProb()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestInitByProb(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
cms.InitByProb(key, 0.01, 0.01);
@@ -55,11 +58,11 @@ public void TestInitByProb()
Assert.Equal(0, info.Count);
}
- [Fact]
- public async Task TestInitByProbAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestInitByProbAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
await cms.InitByProbAsync(key, 0.01, 0.01);
@@ -70,33 +73,33 @@ public async Task TestInitByProbAsync()
Assert.Equal(0, info.Count);
}
- [Fact]
- public void TestKeyAlreadyExists()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestKeyAlreadyExists(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
cms.InitByDim("dup", 16, 4);
Assert.Throws(() => cms.InitByDim("dup", 8, 6));
}
- [Fact]
- public async Task TestKeyAlreadyExistsAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestKeyAlreadyExistsAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
await cms.InitByDimAsync("dup", 16, 4);
await Assert.ThrowsAsync(() => cms.InitByDimAsync("dup", 8, 6));
}
- [Fact]
- public void TestIncrBy()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestIncrBy(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
cms.InitByDim(key, 1000, 5);
@@ -110,11 +113,11 @@ public void TestIncrBy()
}
- [Fact]
- public async Task TestIncrByAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestIncrByAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
await cms.InitByDimAsync(key, 1000, 5);
@@ -128,11 +131,11 @@ public async Task TestIncrByAsync()
}
- [Fact]
- public void TestIncrByMultipleArgs()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestIncrByMultipleArgs(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
cms.InitByDim(key, 1000, 5);
@@ -151,11 +154,11 @@ public void TestIncrByMultipleArgs()
Assert.Equal(25, info.Count);
}
- [Fact]
- public async Task TestIncrByMultipleArgsAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestIncrByMultipleArgsAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
await cms.InitByDimAsync(key, 1000, 5);
@@ -175,11 +178,11 @@ public async Task TestIncrByMultipleArgsAsync()
}
- [Fact]
- public void TestQuery()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestQuery(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
cms.InitByDim(key, 1000, 5);
@@ -193,11 +196,11 @@ public void TestQuery()
Assert.Equal(new long[] { 10, 15 }, resp);
}
- [Fact]
- public async Task TestQueryAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestQueryAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
await cms.InitByDimAsync(key, 1000, 5);
@@ -211,11 +214,11 @@ public async Task TestQueryAsync()
Assert.Equal(new long[] { 10, 15 }, resp);
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise)]
- public void TestMerge()
+ [SkipIfRedis(Is.Enterprise)]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestMerge(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
cms.InitByDim("A", 1000, 5);
@@ -260,11 +263,11 @@ public void TestMerge()
}
- [SkipIfRedis(Is.OSSCluster, Is.Enterprise)]
- public async Task TestMergeAsync()
+ [SkipIfRedis(Is.Enterprise)]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestMergeAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cms = db.CMS();
await cms.InitByDimAsync("A", 1000, 5);
@@ -309,11 +312,13 @@ public async Task TestMergeAsync()
}
- [Fact]
- public void TestModulePrefixs()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestModulePrefixs(string endpointId)
{
- IDatabase db1 = redisFixture.Redis.GetDatabase();
- IDatabase db2 = redisFixture.Redis.GetDatabase();
+ var redis = GetConnection(endpointId);
+ IDatabase db1 = redis.GetDatabase();
+ IDatabase db2 = redis.GetDatabase();
var cms1 = db1.CMS();
var cms2 = db2.CMS();
diff --git a/tests/NRedisStack.Tests/CuckooFilter/CuckooTests.cs b/tests/NRedisStack.Tests/CuckooFilter/CuckooTests.cs
index 7ac2ca3d..1a9b4a6e 100644
--- a/tests/NRedisStack.Tests/CuckooFilter/CuckooTests.cs
+++ b/tests/NRedisStack.Tests/CuckooFilter/CuckooTests.cs
@@ -4,16 +4,22 @@
namespace NRedisStack.Tests.CuckooFilter;
+//
+
public class CuckooTests : AbstractNRedisStackTest, IDisposable
{
private readonly string key = "CUCKOO_TESTS";
- public CuckooTests(RedisFixture redisFixture) : base(redisFixture) { }
- [Fact]
- public void TestReserveBasic()
+ public CuckooTests(EndpointsFixture endpointsFixture) : base(endpointsFixture)
+ {
+ }
+
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestReserveBasic(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ IDatabase db = GetCleanDatabase(endpointId);
+
var cf = db.CF();
Assert.True(cf.Reserve(key, 100L, maxIterations: 20, expansion: 1));
Assert.Throws(() => cf.Reserve(key, 100L));
@@ -23,11 +29,11 @@ public void TestReserveBasic()
Assert.False(cf.Exists(key, "item2"));
}
- [Fact]
- public async Task TestReserveBasicAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestReserveBasicAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
Assert.True(await cf.ReserveAsync(key, 100L, maxIterations: 20, expansion: 1));
_ = Assert.ThrowsAsync(async () => await cf.ReserveAsync(key, 100L));
@@ -37,33 +43,33 @@ public async Task TestReserveBasicAsync()
Assert.False(await cf.ExistsAsync(key, "item2"));
}
- [Fact]
- public void TestAddExists()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestAddExists(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
Assert.True(cf.Add(key, "item1"));
Assert.True(cf.Exists(key, "item1"));
}
- [Fact]
- public async Task TestAddExistsAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestAddExistsAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
Assert.True(await cf.AddAsync(key, "item1"));
Assert.True(await cf.ExistsAsync(key, "item1"));
}
- [Fact]
- public void TestAddNX()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestAddNX(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
Assert.True(cf.AddNX(key, "item1"));
@@ -71,11 +77,11 @@ public void TestAddNX()
Assert.True(cf.Exists(key, "item1"));
}
- [Fact]
- public async Task TestAddNXAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestAddNXAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
Assert.True(await cf.AddNXAsync(key, "item1"));
@@ -83,75 +89,75 @@ public async Task TestAddNXAsync()
Assert.True(await cf.ExistsAsync(key, "item1"));
}
- [Fact]
- public void TestCountFilterDoesNotExist()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestCountFilterDoesNotExist(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
Assert.Equal(0, cf.Count("notExistFilter", "notExistItem"));
}
- [Fact]
- public async Task TestCountFilterDoesNotExistAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestCountFilterDoesNotExistAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
Assert.Equal(0, await cf.CountAsync("notExistFilter", "notExistItem"));
}
- [Fact]
- public void TestCountFilterExist()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestCountFilterExist(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
cf.Insert(key, new RedisValue[] { "foo" });
Assert.Equal(0, cf.Count(key, "notExistItem"));
}
- [Fact]
- public async Task TestCountFilterExistAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestCountFilterExistAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
await cf.InsertAsync(key, new RedisValue[] { "foo" });
Assert.Equal(0, await cf.CountAsync(key, "notExistItem"));
}
- [Fact]
- public void TestCountItemExist()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestCountItemExist(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
cf.Insert(key, new RedisValue[] { "foo" });
Assert.Equal(1, cf.Count(key, "foo"));
}
- [Fact]
- public async Task TestCountItemExistAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestCountItemExistAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
await cf.InsertAsync(key, new RedisValue[] { "foo" });
Assert.Equal(1, await cf.CountAsync(key, "foo"));
}
- [Fact]
- public void TestDelete()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestDelete(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
cf.Add(key, "item");
@@ -161,11 +167,11 @@ public void TestDelete()
Assert.Throws(() => cf.Del("notExistKey", "item"));
}
- [Fact]
- public async Task TestDeleteAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestDeleteAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
await cf.AddAsync(key, "item");
@@ -175,11 +181,11 @@ public async Task TestDeleteAsync()
await Assert.ThrowsAsync(() => cf.DelAsync("notExistKey", "item"));
}
- [Fact]
- public void TestInfo()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestInfo(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
cf.Add(key, "item");
@@ -198,11 +204,11 @@ public void TestInfo()
Assert.Throws(() => cf.Info("notExistKey"));
}
- [Fact]
- public async Task TestInfoAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestInfoAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
await cf.AddAsync(key, "item");
@@ -223,11 +229,11 @@ public async Task TestInfoAsync()
await Assert.ThrowsAsync(() => cf.InfoAsync("notExistKey"));
}
- [Fact]
- public void TestInsert()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestInsert(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
RedisValue[] items = new RedisValue[] { "item1", "item2", "item3" };
@@ -239,11 +245,11 @@ public void TestInsert()
Assert.True(cf.Exists("key", "item3"));
}
- [Fact]
- public async Task TestInsertAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestInsertAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
RedisValue[] items = new RedisValue[] { "item1", "item2", "item3" };
@@ -255,11 +261,11 @@ public async Task TestInsertAsync()
Assert.True(await cf.ExistsAsync("key", "item3"));
}
- [Fact]
- public void TestInsertNX()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestInsertNX(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
RedisValue[] items = new RedisValue[] { "item1", "item2", "item3" };
@@ -283,11 +289,11 @@ public void TestInsertNX()
Assert.Throws(() => cf.InsertNX(key, new RedisValue[] { }));
}
- [Fact]
- public async Task TestInsertNXAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestInsertNXAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
RedisValue[] items = new RedisValue[] { "item1", "item2", "item3" };
@@ -311,33 +317,33 @@ public async Task TestInsertNXAsync()
_ = Assert.ThrowsAsync(async () => await cf.InsertNXAsync(key, new RedisValue[] { }));
}
- [Fact]
- public void TestExistsNonExist()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestExistsNonExist(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
RedisValue item = new RedisValue("item");
Assert.False(cf.Exists("NonExistKey", item));
}
- [Fact]
- public async Task TestExistsNonExistAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestExistsNonExistAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
RedisValue item = new RedisValue("item");
Assert.False(await cf.ExistsAsync("NonExistKey", item));
}
- [Fact]
- public void TestScanDumpAndLoadChunk()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestScanDumpAndLoadChunk(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
cf.Reserve("cuckoo", 100, 50);
@@ -358,11 +364,11 @@ public void TestScanDumpAndLoadChunk()
Assert.True(cf.Exists("cuckoo-load", "a"));
}
- [Fact]
- public async Task TestScanDumpAndLoadChunkAsync()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ public async Task TestScanDumpAndLoadChunkAsync(string endpointId)
{
- IDatabase db = redisFixture.Redis.GetDatabase();
- db.Execute("FLUSHALL");
+ var db = GetCleanDatabase(endpointId);
var cf = db.CF();
await cf.ReserveAsync("cuckoo", 100, 50);
@@ -384,11 +390,14 @@ public async Task TestScanDumpAndLoadChunkAsync()
}
- [Fact]
- public void TestModulePrefixs()
+ [SkippableTheory]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
+ public void TestModulePrefixs(string endpointId)
{
- IDatabase db1 = redisFixture.Redis.GetDatabase();
- IDatabase db2 = redisFixture.Redis.GetDatabase();
+ var redis = GetConnection(endpointId);
+
+ IDatabase db1 = redis.GetDatabase();
+ IDatabase db2 = redis.GetDatabase();
var cf1 = db1.CF();
var cf2 = db2.CF();
diff --git a/tests/NRedisStack.Tests/EndpointsFixture.cs b/tests/NRedisStack.Tests/EndpointsFixture.cs
new file mode 100644
index 00000000..00ba786a
--- /dev/null
+++ b/tests/NRedisStack.Tests/EndpointsFixture.cs
@@ -0,0 +1,99 @@
+using StackExchange.Redis;
+using System.Text.Json;
+using Xunit;
+
+namespace NRedisStack.Tests;
+
+public class EndpointConfig
+{
+ public List? endpoints { get; set; }
+
+ public bool tls { get; set; }
+
+ public string? password { get; set; }
+
+ public int? bdb_id { get; set; }
+
+ public object? raw_endpoints { get; set; }
+
+ public ConnectionMultiplexer CreateConnection(ConfigurationOptions configurationOptions)
+ {
+ configurationOptions.EndPoints.Clear();
+
+ foreach (var endpoint in endpoints!)
+ {
+ configurationOptions.EndPoints.Add(endpoint);
+ }
+
+ if (password != null)
+ {
+ configurationOptions.Password = password;
+ }
+
+ // TODO(imalinovskiy): Add support for TLS
+ // TODO(imalinovskiy): Add support for Discovery/Sentinel API
+
+ return ConnectionMultiplexer.Connect(configurationOptions);
+ }
+}
+
+
+public class EndpointsFixture : IDisposable
+{
+ public static class Env
+ {
+ public const string Standalone = "standalone";
+ public const string StandaloneEntraId = "standalone-entraid";
+ public const string Cluster = "cluster";
+
+ public static IEnumerable