Skip to content

Commit f5b2597

Browse files
committed
CSHARP-3225: Skip SetWindowFields tests on older servers.
1 parent 53a2b1f commit f5b2597

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-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
@@ -99,6 +99,7 @@ public class Feature
9999
private static readonly Feature __serverExtractsUsernameFromX509Certificate = new Feature("ServerExtractsUsernameFromX509Certificate", WireVersion.Server34);
100100
private static readonly Feature __serverReturnsResumableChangeStreamErrorLabel = new Feature("ServerReturnsResumableChangeStreamErrorLabel", WireVersion.Server44);
101101
private static readonly Feature __serverReturnsRetryableWriteErrorLabel = new Feature("ServerReturnsRetryableWriteErrorLabel", WireVersion.Server44);
102+
private static readonly Feature __setWindowFields = new Feature("SetWindowFields", WireVersion.Server50);
102103
private static readonly Feature __shardedTransactions = new Feature("ShardedTransactions", WireVersion.Server42);
103104
private static readonly Feature __snapshotReads = new Feature("SnapshotReads", WireVersion.Server50, notSupportedMessage: "Snapshot reads require MongoDB 5.0 or later");
104105
private static readonly Feature __speculativeAuthentication = new Feature("SpeculativeAuthentication", WireVersion.Server44);
@@ -540,6 +541,11 @@ public class Feature
540541
/// </summary>
541542
public static Feature ServerReturnsRetryableWriteErrorLabel => __serverReturnsRetryableWriteErrorLabel;
542543

544+
/// <summary>
545+
/// Gets the set window fields feature.
546+
/// </summary>
547+
public static Feature SetWindowFields => __setWindowFields;
548+
543549
/// <summary>
544550
/// Gets the sharded transactions feature.
545551
/// </summary>

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
using System;
1717
using System.Linq;
1818
using FluentAssertions;
19+
using MongoDB.Driver.Core.Misc;
20+
using MongoDB.Driver.Core.TestHelpers.XunitExtensions;
1921
using MongoDB.Driver.Linq;
2022
using MongoDB.Driver.Tests.Linq.Linq3ImplementationTests;
2123
using Xunit;
@@ -29,6 +31,7 @@ public class CSharp3225Tests
2931
[Fact]
3032
public void Use_documents_window_to_obtain_cumulative_quantity_for_each_state_example_should_work()
3133
{
34+
RequireServer.Check().Supports(Feature.SetWindowFields);
3235
var collection = Setup();
3336

3437
var aggregate = collection
@@ -73,6 +76,7 @@ public void Use_documents_window_to_obtain_cumulative_quantity_for_each_state_ex
7376
[Fact]
7477
public void Use_documents_window_to_obtain_cumulative_quantity_for_each_year_example_should_work()
7578
{
79+
RequireServer.Check().Supports(Feature.SetWindowFields);
7680
var collection = Setup();
7781

7882
var aggregate = collection
@@ -117,6 +121,7 @@ public void Use_documents_window_to_obtain_cumulative_quantity_for_each_year_exa
117121
[Fact]
118122
public void Use_documents_window_to_obtain_moving_average_quantity_for_each_year_example_should_work()
119123
{
124+
RequireServer.Check().Supports(Feature.SetWindowFields);
120125
var collection = Setup();
121126

122127
var aggregate = collection
@@ -161,6 +166,7 @@ public void Use_documents_window_to_obtain_moving_average_quantity_for_each_year
161166
[Fact]
162167
public void Use_documents_window_to_obtain_cumulative_and_maximum_quantity_for_each_year_example_should_work()
163168
{
169+
RequireServer.Check().Supports(Feature.SetWindowFields);
164170
var collection = Setup();
165171

166172
var aggregate = collection
@@ -215,6 +221,7 @@ public void Use_documents_window_to_obtain_cumulative_and_maximum_quantity_for_e
215221
[Fact]
216222
public void Range_window_example_should_work()
217223
{
224+
RequireServer.Check().Supports(Feature.SetWindowFields);
218225
var collection = Setup();
219226

220227
var aggregate = collection
@@ -259,6 +266,7 @@ public void Range_window_example_should_work()
259266
[Fact]
260267
public void Use_a_time_range_window_with_a_positive_upper_bound_example_should_work()
261268
{
269+
RequireServer.Check().Supports(Feature.SetWindowFields);
262270
var collection = Setup();
263271

264272
var aggregate = collection
@@ -304,6 +312,7 @@ public void Use_a_time_range_window_with_a_positive_upper_bound_example_should_w
304312
[Fact]
305313
public void Use_a_time_range_window_with_a_negative_upper_bound_example_should_work()
306314
{
315+
RequireServer.Check().Supports(Feature.SetWindowFields);
307316
var collection = Setup();
308317

309318
var aggregate = collection

0 commit comments

Comments
 (0)