diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml
index a9110779..1e4ad625 100644
--- a/.github/actions/run-tests/action.yml
+++ b/.github/actions/run-tests/action.yml
@@ -102,6 +102,8 @@ runs:
- name: Test
shell: bash
+ env:
+ REDIS_VERSION: ${{ inputs.redis-version }}
run: |
echo "::group::Run tests"
echo "${{inputs.REDIS_CA_PEM}}" > tests/NRedisStack.Tests/bin/Debug/${CLR_VERSION}/redis_ca.pem
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index c6c91e56..0688dd12 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -37,7 +37,7 @@ jobs:
max-parallel: 15
fail-fast: false
matrix:
- redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}', '7.2.6', '6.2.16']
+ redis-version: [ '8.0-M02', '8.0-M03', '${{ 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
@@ -104,5 +104,7 @@ jobs:
./redis-stack-server-${{env.redis_stack_version}}/bin/redis-cli INFO SERVER | grep redis_version
- name: Test
shell: cmd
+ env:
+ REDIS_VERSION: ${{env.redis_stack_version}}
run: |
dotnet test -f net481 --no-build --verbosity detailed -p:BuildInParallel=false tests/Test.proj --logger GitHubActions
diff --git a/tests/NRedisStack.Tests/CountMinSketch/CmsTests.cs b/tests/NRedisStack.Tests/CountMinSketch/CmsTests.cs
index 76ac586b..a3f1998d 100644
--- a/tests/NRedisStack.Tests/CountMinSketch/CmsTests.cs
+++ b/tests/NRedisStack.Tests/CountMinSketch/CmsTests.cs
@@ -215,7 +215,7 @@ public async Task TestQueryAsync(string endpointId)
}
[SkipIfRedis(Is.Enterprise)]
- [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public void TestMerge(string endpointId)
{
var db = GetCleanDatabase(endpointId);
@@ -264,7 +264,7 @@ public void TestMerge(string endpointId)
[SkipIfRedis(Is.Enterprise)]
- [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public async Task TestMergeAsync(string endpointId)
{
var db = GetCleanDatabase(endpointId);
diff --git a/tests/NRedisStack.Tests/Graph/GraphTests.cs b/tests/NRedisStack.Tests/Graph/GraphTests.cs
index 53c6f1e8..63e6d45a 100644
--- a/tests/NRedisStack.Tests/Graph/GraphTests.cs
+++ b/tests/NRedisStack.Tests/Graph/GraphTests.cs
@@ -1,3 +1,4 @@
+using System.Diagnostics.CodeAnalysis;
using Xunit;
using StackExchange.Redis;
using NRedisStack.RedisStackCommands;
@@ -6,6 +7,7 @@
namespace NRedisStack.Tests.Graph;
+[SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")]
public class GraphTests : AbstractNRedisStackTest, IDisposable
{
public GraphTests(EndpointsFixture endpointsFixture) : base(endpointsFixture)
@@ -797,7 +799,7 @@ private void AssertTestGeoPoint(IGraphCommands graph)
[SkipIfRedis(Comparison.GreaterThanOrEqual, "7.1.242")]
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
[Obsolete]
- public void TestPoint()
+ public void TestPoint(string endpointId)
{
var point = new Point(30.27822306, -97.75134723);
diff --git a/tests/NRedisStack.Tests/NRedisStack.Tests.csproj b/tests/NRedisStack.Tests/NRedisStack.Tests.csproj
index 8341e048..ca7c29f7 100644
--- a/tests/NRedisStack.Tests/NRedisStack.Tests.csproj
+++ b/tests/NRedisStack.Tests/NRedisStack.Tests.csproj
@@ -26,6 +26,7 @@
all
+
diff --git a/tests/NRedisStack.Tests/Search/IndexCreationTests.cs b/tests/NRedisStack.Tests/Search/IndexCreationTests.cs
index 17b1de4c..0db286ef 100644
--- a/tests/NRedisStack.Tests/Search/IndexCreationTests.cs
+++ b/tests/NRedisStack.Tests/Search/IndexCreationTests.cs
@@ -42,7 +42,7 @@ public void TestMissingEmptyFieldCommandArgs()
}
[SkipIfRedis(Comparison.LessThan, "7.3.240")]
- [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public void TestMissingFields(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
diff --git a/tests/NRedisStack.Tests/SkipIfRedisAttribute.cs b/tests/NRedisStack.Tests/SkipIfRedisAttribute.cs
index 9a3fc098..acfebfe3 100644
--- a/tests/NRedisStack.Tests/SkipIfRedisAttribute.cs
+++ b/tests/NRedisStack.Tests/SkipIfRedisAttribute.cs
@@ -1,4 +1,5 @@
using Xunit;
+using Xunit.Sdk;
namespace NRedisStack.Tests;
@@ -14,6 +15,7 @@ public enum Is
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
+[XunitTestCaseDiscoverer("NRedisStack.Tests.SkippableTheoryDiscoverer", "NRedisStack.Tests")]
public class SkipIfRedisAttribute : SkippableTheoryAttribute
{
private readonly string _targetVersion;
@@ -30,19 +32,6 @@ public SkipIfRedisAttribute(
_targetVersion = targetVersion;
}
- // skip more than one environment:
- public SkipIfRedisAttribute(
- Is environment1,
- Is environment2,
- Comparison comparison = Comparison.LessThan,
- string targetVersion = "0.0.0")
- {
- _environments.Add(environment1);
- _environments.Add(environment2);
- _comparison = comparison;
- _targetVersion = targetVersion;
- }
-
public SkipIfRedisAttribute(string targetVersion) // defaults to LessThan
{
_comparison = Comparison.LessThan;
diff --git a/tests/NRedisStack.Tests/SkippableTheoryDiscoverer.cs b/tests/NRedisStack.Tests/SkippableTheoryDiscoverer.cs
new file mode 100644
index 00000000..a7e6535e
--- /dev/null
+++ b/tests/NRedisStack.Tests/SkippableTheoryDiscoverer.cs
@@ -0,0 +1,61 @@
+using Xunit.Sdk;
+
+namespace NRedisStack.Tests;
+
+// TODO(imalinovskiy): Remove this file once tests are migrated to Xunit v3
+
+/// Copyright (c) Andrew Arnott. All rights reserved.
+// Licensed under the Microsoft Public License (Ms-PL).
+// https://github.com/AArnott/Xunit.SkippableFact/blob/main/src/Xunit.SkippableFact/Sdk/SkippableTheoryDiscoverer.cs
+// See https://github.com/AArnott/Xunit.SkippableFact/blob/main/LICENSE for full license information.
+
+using System.Collections.Generic;
+using Validation;
+using Xunit.Abstractions;
+
+///
+/// Patched TestCase discoverer to support SkipIfRedisAttribute.
+///
+public class SkippableTheoryDiscoverer : IXunitTestCaseDiscoverer
+{
+ ///
+ /// The diagnostic message sink provided to the constructor.
+ ///
+ private readonly IMessageSink diagnosticMessageSink;
+
+ ///
+ /// The complex theory discovery process that we wrap.
+ ///
+ private readonly TheoryDiscoverer theoryDiscoverer;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message sink used to send diagnostic messages.
+ public SkippableTheoryDiscoverer(IMessageSink diagnosticMessageSink)
+ {
+ this.diagnosticMessageSink = diagnosticMessageSink;
+ this.theoryDiscoverer = new TheoryDiscoverer(diagnosticMessageSink);
+ }
+
+ ///
+ public virtual IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
+ {
+ Requires.NotNull(factAttribute, nameof(factAttribute));
+ string[] skippingExceptionNames = new[] { "Xunit.SkippableFact.SkipException" };
+ TestMethodDisplay defaultMethodDisplay = discoveryOptions.MethodDisplayOrDefault();
+
+ IEnumerable? basis = this.theoryDiscoverer.Discover(discoveryOptions, testMethod, factAttribute);
+ foreach (IXunitTestCase? testCase in basis)
+ {
+ if (testCase is XunitTheoryTestCase)
+ {
+ yield return new SkippableTheoryTestCase(skippingExceptionNames, this.diagnosticMessageSink, defaultMethodDisplay, discoveryOptions.MethodDisplayOptionsOrDefault(), testCase.TestMethod);
+ }
+ else
+ {
+ yield return new SkippableFactTestCase(skippingExceptionNames, this.diagnosticMessageSink, defaultMethodDisplay, discoveryOptions.MethodDisplayOptionsOrDefault(), testCase.TestMethod, testCase.TestMethodArguments);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/NRedisStack.Tests/TransactionsTests.cs b/tests/NRedisStack.Tests/TransactionsTests.cs
index ed870c2e..1b249be5 100644
--- a/tests/NRedisStack.Tests/TransactionsTests.cs
+++ b/tests/NRedisStack.Tests/TransactionsTests.cs
@@ -15,7 +15,7 @@ public TransactionTests(EndpointsFixture endpointsFixture) : base(endpointsFixtu
}
[SkippableTheory]
- [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
public void TestJsonTransaction(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
@@ -34,7 +34,7 @@ public void TestJsonTransaction(string endpointId)
}
[SkipIfRedis(Comparison.GreaterThanOrEqual, "7.1.242")]
- [MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
+ [MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
[Obsolete]
public void TestModulesTransaction(string endpointId)
{