Skip to content

Commit ddf6e5c

Browse files
committed
CSHARP-2274: Fix ListCollectionNames tests on older server versions.
1 parent 2280299 commit ddf6e5c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/MongoDB.Driver.Tests/MongoDatabaseImplTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using MongoDB.Bson.TestHelpers.XunitExtensions;
2525
using MongoDB.Driver.Core.Bindings;
2626
using MongoDB.Driver.Core.Clusters;
27+
using MongoDB.Driver.Core.Misc;
2728
using MongoDB.Driver.Core.Operations;
2829
using MongoDB.Driver.Core.TestHelpers.XunitExtensions;
2930
using MongoDB.Driver.Tests;
@@ -554,6 +555,10 @@ public void ListCollectionNames_should_return_expected_result(
554555
[Values(false, true)] bool async)
555556
{
556557
RequireServer.Check();
558+
if (usingSession)
559+
{
560+
RequireServer.Check().VersionGreaterThanOrEqualTo("3.6.0");
561+
}
557562

558563
var collectionNames = Enumerable.Range(1, numberOfCollections).Select(n => $"c{n}").ToArray();
559564

@@ -592,7 +597,7 @@ public void ListCollectionNames_should_return_expected_result(
592597
}
593598

594599
var actualCollectionNames = cursor.ToList();
595-
actualCollectionNames.Should().BeEquivalentTo(collectionNames);
600+
actualCollectionNames.Where(n => n != "system.indexes").Should().BeEquivalentTo(collectionNames);
596601
}
597602
}
598603

0 commit comments

Comments
 (0)