Skip to content

Commit e68ba11

Browse files
committed
grandfather many cluster tests pre 8
1 parent 6cef256 commit e68ba11

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/NRedisStack.Tests/Search/SearchTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ public class SearchTests(EndpointsFixture endpointsFixture, ITestOutputHelper lo
1919
// private readonly string key = "SEARCH_TESTS";
2020
private readonly string index = "TEST_INDEX";
2121

22+
private static void SkipClusterPre8(string endpointId)
23+
{
24+
// Many of the FT.* commands are ... more awkward pre 8 when using cluster. Rather than
25+
// fight eventual-consistency/timing issues: grandfather the existing behaviour, and start
26+
// afresh from v8, where things behave much more predictably and reasonably.
27+
Skip.If(endpointId == EndpointsFixture.Env.Cluster
28+
&& EndpointsFixture.RedisVersion.Major < 8, "Ignoring cluster tests for FT.SEARCH pre Redis 8.0");
29+
}
30+
2231
private void AddDocument(IDatabase db, Document doc)
2332
{
2433
var hash = doc.GetProperties()
@@ -235,6 +244,7 @@ public async Task TestAggregationsAsync(string endpointId)
235244
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
236245
public void TestAggregationsLoad(string endpointId)
237246
{
247+
SkipClusterPre8(endpointId);
238248
IDatabase db = GetCleanDatabase(endpointId);
239249
var ft = db.FT();
240250
var sc = new Schema().AddTextField("t1").AddTextField("t2");
@@ -632,6 +642,7 @@ public async Task TestCreateAsync(string endpointId)
632642
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
633643
public void CreateNoParams(string endpointId)
634644
{
645+
SkipClusterPre8(endpointId);
635646
IDatabase db = GetCleanDatabase(endpointId);
636647
var ft = db.FT();
637648

@@ -690,6 +701,7 @@ public async Task CreateNoParamsAsync(string endpointId)
690701
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
691702
public void CreateWithFieldNames(string endpointId)
692703
{
704+
SkipClusterPre8(endpointId);
693705
IDatabase db = GetCleanDatabase(endpointId);
694706
var ft = db.FT();
695707
Schema sc = new Schema().AddField(new TextField(FieldName.Of("first").As("given")))
@@ -869,6 +881,7 @@ public void AlterAdd(string endpointId)
869881
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
870882
public async Task AlterAddAsync(string endpointId)
871883
{
884+
SkipClusterPre8(endpointId);
872885
IDatabase db = GetCleanDatabase(endpointId);
873886
var ft = db.FT();
874887
Schema sc = new Schema().AddTextField("title", 1.0);
@@ -956,6 +969,7 @@ public async Task AlterAddAsync(string endpointId)
956969
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
957970
public void AlterAddSortable(string endpointId)
958971
{
972+
SkipClusterPre8(endpointId);
959973
IDatabase db = GetCleanDatabase(endpointId);
960974
var ft = db.FT();
961975
Schema sc = new Schema().AddTextField("title", 1.0, sortable: true);
@@ -1251,6 +1265,7 @@ public async Task TestDialectConfigAsync(string endpointId)
12511265
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
12521266
public async Task TestCursor(string endpointId)
12531267
{
1268+
SkipClusterPre8(endpointId);
12541269
IDatabase db = GetCleanDatabase(endpointId);
12551270
var ft = db.FT();
12561271
Schema sc = new();
@@ -1306,6 +1321,7 @@ public async Task TestCursor(string endpointId)
13061321
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
13071322
public void TestCursorEnumerable(string endpointId)
13081323
{
1324+
SkipClusterPre8(endpointId);
13091325
IDatabase db = GetCleanDatabase(endpointId);
13101326
var ft = db.FT();
13111327
Schema sc = new();
@@ -1344,6 +1360,7 @@ public void TestCursorEnumerable(string endpointId)
13441360
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
13451361
public async Task TestCursorAsync(string endpointId)
13461362
{
1363+
SkipClusterPre8(endpointId);
13471364
IDatabase db = GetCleanDatabase(endpointId);
13481365
var ft = db.FT();
13491366
Schema sc = new();
@@ -1399,6 +1416,7 @@ public async Task TestCursorAsync(string endpointId)
13991416
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
14001417
public async Task TestCursorEnumerableAsync(string endpointId)
14011418
{
1419+
SkipClusterPre8(endpointId);
14021420
IDatabase db = GetCleanDatabase(endpointId);
14031421
var ft = db.FT();
14041422
Schema sc = new();
@@ -1587,6 +1605,7 @@ public void TestDictionary(string endpointId)
15871605
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
15881606
public void TestDropIndex(string endpointId)
15891607
{
1608+
SkipClusterPre8(endpointId);
15901609
IDatabase db = GetCleanDatabase(endpointId);
15911610
var ft = db.FT();
15921611
Schema sc = new Schema().AddTextField("title", 1.0);
@@ -1656,6 +1675,7 @@ private async Task<int> DatabaseSizeAsync(IDatabase db)
16561675
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
16571676
public async Task TestDropIndexAsync(string endpointId)
16581677
{
1678+
SkipClusterPre8(endpointId);
16591679
IDatabase db = GetCleanDatabase(endpointId);
16601680
var ft = db.FT();
16611681
Schema sc = new Schema().AddTextField("title", 1.0);
@@ -1690,6 +1710,7 @@ public async Task TestDropIndexAsync(string endpointId)
16901710
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
16911711
public void dropIndexDD(string endpointId)
16921712
{
1713+
SkipClusterPre8(endpointId);
16931714
IDatabase db = GetCleanDatabase(endpointId);
16941715
var ft = db.FT();
16951716
Schema sc = new Schema().AddTextField("title", 1.0);
@@ -1716,6 +1737,7 @@ public void dropIndexDD(string endpointId)
17161737
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
17171738
public async Task dropIndexDDAsync(string endpointId)
17181739
{
1740+
SkipClusterPre8(endpointId);
17191741
IDatabase db = GetCleanDatabase(endpointId);
17201742
var ft = db.FT();
17211743
Schema sc = new Schema().AddTextField("title", 1.0);
@@ -2145,6 +2167,7 @@ public void TestFTCreateParamsCommandBuilderNoStopwords()
21452167
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
21462168
public void TestFilters(string endpointId)
21472169
{
2170+
SkipClusterPre8(endpointId);
21482171
IDatabase db = GetCleanDatabase(endpointId);
21492172
var ft = db.FT();
21502173
// Create the index with the same fields as in the original test
@@ -2465,6 +2488,7 @@ public void TestFieldsCommandBuilder()
24652488
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
24662489
public void TestLimit(string endpointId)
24672490
{
2491+
SkipClusterPre8(endpointId);
24682492
IDatabase db = GetCleanDatabase(endpointId);
24692493
var ft = db.FT();
24702494

@@ -2486,6 +2510,7 @@ public void TestLimit(string endpointId)
24862510
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
24872511
public async Task TestLimitAsync(string endpointId)
24882512
{
2513+
SkipClusterPre8(endpointId);
24892514
IDatabase db = GetCleanDatabase(endpointId);
24902515
var ft = db.FT();
24912516

@@ -2602,6 +2627,7 @@ public void VectorSimilaritySearch(string endpointId)
26022627
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
26032628
public void QueryingVectorFields(string endpointId)
26042629
{
2630+
SkipClusterPre8(endpointId);
26052631
IDatabase db = GetCleanDatabase(endpointId);
26062632
var ft = db.FT();
26072633
var json = db.JSON();
@@ -2690,6 +2716,7 @@ public async Task TestQueryAddParam_DefaultDialectAsync(string endpointId)
26902716
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
26912717
public void TestQueryParamsWithParams_DefaultDialect(string endpointId)
26922718
{
2719+
SkipClusterPre8(endpointId);
26932720
IDatabase db = GetCleanDatabase(endpointId);
26942721
var ft = db.FT(2);
26952722

@@ -2761,6 +2788,7 @@ public async Task TestBasicSpellCheckAsync(string endpointId)
27612788
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
27622789
public void TestCrossTermDictionary(string endpointId)
27632790
{
2791+
SkipClusterPre8(endpointId);
27642792
IDatabase db = GetCleanDatabase(endpointId);
27652793
var ft = db.FT();
27662794

@@ -2787,6 +2815,7 @@ public void TestCrossTermDictionary(string endpointId)
27872815
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
27882816
public async Task TestCrossTermDictionaryAsync(string endpointId)
27892817
{
2818+
SkipClusterPre8(endpointId);
27902819
IDatabase db = GetCleanDatabase(endpointId);
27912820
var ft = db.FT();
27922821

@@ -2858,6 +2887,7 @@ await Assert.ThrowsAsync<RedisServerException>(async () =>
28582887
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
28592888
public async Task TestQueryParamsWithParams_DefaultDialectAsync(string endpointId)
28602889
{
2890+
SkipClusterPre8(endpointId);
28612891
IDatabase db = GetCleanDatabase(endpointId);
28622892
var ft = db.FT(2);
28632893

@@ -3344,6 +3374,7 @@ public void TestProfileIssue306(string endpointId)
33443374
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
33453375
public async Task TestProfileAsyncIssue306(string endpointId)
33463376
{
3377+
SkipClusterPre8(endpointId);
33473378
IDatabase db = GetCleanDatabase(endpointId);
33483379
var ft = db.FT();
33493380

@@ -3404,6 +3435,7 @@ public void Issue175(string endpointId)
34043435
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
34053436
public void GeoShapeFilterSpherical(string endpointId)
34063437
{
3438+
SkipClusterPre8(endpointId);
34073439
IDatabase db = GetCleanDatabase(endpointId);
34083440
var ft = db.FT();
34093441

@@ -3469,6 +3501,7 @@ public void GeoShapeFilterSpherical(string endpointId)
34693501
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
34703502
public async Task GeoShapeFilterSphericalAsync(string endpointId)
34713503
{
3504+
SkipClusterPre8(endpointId);
34723505
IDatabase db = GetCleanDatabase(endpointId);
34733506
var ft = db.FT();
34743507

0 commit comments

Comments
 (0)