Skip to content

Commit 5c0dbae

Browse files
committed
CSHARP-3915: Skip Densify tests on servers that don't support it.
1 parent b99707d commit 5c0dbae

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/MongoDB.Driver.Core/Core/Misc/Feature.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class Feature
5757
private static readonly Feature __createIndexesCommand = new Feature("CreateIndexesCommand", WireVersion.Server26);
5858
private static readonly Feature __createIndexesUsingInsertOperations = new Feature("CreateIndexesUsingInsertOperations", WireVersion.Zero, WireVersion.Server42);
5959
private static readonly Feature __currentOpCommand = new Feature("CurrentOpCommand", WireVersion.Server32);
60+
private static readonly Feature __densifyStage = new Feature("DensifyStage", WireVersion.Server51);
6061
private static readonly Feature __documentValidation = new Feature("DocumentValidation", WireVersion.Server32);
6162
private static readonly Feature __directConnectionSetting = new Feature("DirectConnectionSetting", WireVersion.Server44);
6263
private static readonly Feature __eval = new Feature("Eval", WireVersion.Zero, WireVersion.Server42);
@@ -306,6 +307,11 @@ public class Feature
306307
[Obsolete("This property will be removed in a later release.")]
307308
public static Feature CurrentOpCommand => __currentOpCommand;
308309

310+
/// <summary>
311+
/// Gets the aggregate $densify stage feature.
312+
/// </summary>
313+
public static Feature DensifyStage => __densifyStage;
314+
309315
/// <summary>
310316
/// Gets the document validation feature.
311317
/// </summary>

tests/MongoDB.Driver.Tests/Jira/CSharp3915Tests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
using System.Linq;
1818
using FluentAssertions;
1919
using MongoDB.Bson.IO;
20+
using MongoDB.Driver.Core.Misc;
21+
using MongoDB.Driver.Core.TestHelpers.XunitExtensions;
2022
using MongoDB.Driver.Linq;
2123
using MongoDB.Driver.Tests.Linq.Linq3ImplementationTests;
2224
using Xunit;
@@ -31,6 +33,7 @@ public class CSharp3915Tests : Linq3IntegrationTest
3133
[InlineData(true)]
3234
public void Densify_time_series_data_example_using_aggregate_should_work(bool usingExpressions)
3335
{
36+
RequireServer.Check().Supports(Feature.DensifyStage);
3437
var collection = CreateWeatherCollection();
3538
var subject = collection.Aggregate();
3639

@@ -76,6 +79,7 @@ public void Densify_time_series_data_example_using_aggregate_should_work(bool us
7679
[Fact]
7780
public void Densify_time_series_data_example_using_linq_should_work()
7881
{
82+
RequireServer.Check().Supports(Feature.DensifyStage);
7983
var collection = CreateWeatherCollection();
8084
var subject = collection.AsQueryable();
8185

@@ -113,6 +117,7 @@ public void Densify_time_series_data_example_using_linq_should_work()
113117
[InlineData(true)]
114118
public void Densify_the_full_range_of_values_example_using_aggregate_should_work(bool usingExpressions)
115119
{
120+
RequireServer.Check().Supports(Feature.DensifyStage);
116121
var collection = CreateCoffeeCollection();
117122
var subject = collection.Aggregate();
118123

@@ -162,6 +167,7 @@ public void Densify_the_full_range_of_values_example_using_aggregate_should_work
162167
[Fact]
163168
public void Densify_the_full_range_of_values_example_using_linq_should_work()
164169
{
170+
RequireServer.Check().Supports(Feature.DensifyStage);
165171
var collection = CreateCoffeeCollection();
166172
var subject = collection.AsQueryable();
167173

@@ -202,6 +208,7 @@ public void Densify_the_full_range_of_values_example_using_linq_should_work()
202208
[InlineData(true)]
203209
public void Densify_values_within_each_partition_example_using_aggregate_should_work(bool usingExpressions)
204210
{
211+
RequireServer.Check().Supports(Feature.DensifyStage);
205212
var collection = CreateCoffeeCollection();
206213
var subject = collection.Aggregate();
207214

@@ -243,6 +250,7 @@ public void Densify_values_within_each_partition_example_using_aggregate_should_
243250
[Fact]
244251
public void Densify_values_within_each_partition_example_using_linq_should_work()
245252
{
253+
RequireServer.Check().Supports(Feature.DensifyStage);
246254
var collection = CreateCoffeeCollection();
247255
var subject = collection.AsQueryable();
248256

0 commit comments

Comments
 (0)