Skip to content

Commit

Permalink
CSHARP-4965: Bump maxWireVersion for MongoDB 7.2 (#1266)
Browse files Browse the repository at this point in the history
  • Loading branch information
adelinowona committed Feb 13, 2024
1 parent 88455ac commit fdd2ba5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
14 changes: 12 additions & 2 deletions src/MongoDB.Driver.Core/Core/Misc/WireVersion.cs
Expand Up @@ -104,6 +104,14 @@ internal static class WireVersion
/// Wire version 21.
/// </summary>
public const int Server70 = 21;
/// <summary>
/// Wire version 22.
/// </summary>
public const int Server71 = 22;
/// <summary>
/// Wire version 23.
/// </summary>
public const int Server72 = 23;

#region static
private static List<WireVersionInfo> __knownWireVersions = new()
Expand Down Expand Up @@ -134,10 +142,12 @@ internal static class WireVersion
new WireVersionInfo(wireVersion: 18, major: 6, minor: 1),
new WireVersionInfo(wireVersion: 19, major: 6, minor: 2),
new WireVersionInfo(wireVersion: 20, major: 6, minor: 3),
new WireVersionInfo(wireVersion: 21, major: 7, minor: 0)
new WireVersionInfo(wireVersion: 21, major: 7, minor: 0),
new WireVersionInfo(wireVersion: 22, major: 7, minor: 1),
new WireVersionInfo(wireVersion: 23, major: 7, minor: 2)
};

private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: 6, maxWireVersion: 21);
private static Range<int> __supportedWireVersionRange = CreateSupportedWireVersionRange(minWireVersion: 6, maxWireVersion: 23);

private static Range<int> CreateSupportedWireVersionRange(int minWireVersion, int maxWireVersion)
{
Expand Down
6 changes: 3 additions & 3 deletions tests/MongoDB.Driver.Core.Tests/Core/Clusters/ClusterTests.cs
Expand Up @@ -64,7 +64,7 @@ public void SupportedWireVersionRange_should_return_expected_result()
{
var result = Cluster.SupportedWireVersionRange;

result.Should().Be(new Range<int>(6, 21));
result.Should().Be(new Range<int>(6, 23));
}

[Fact]
Expand Down Expand Up @@ -331,8 +331,8 @@ public void AcquireServerSession_should_call_serverSessionPool_AcquireSession()
[Theory]
[InlineData(0, 0, false)]
[InlineData(0, 0, true)]
[InlineData(22, 23, false)]
[InlineData(22, 23, true)]
[InlineData(24, 25, false)]
[InlineData(24, 25, true)]
public void SelectServer_should_throw_if_any_servers_are_incompatible(int min, int max, bool async)
{
var subject = CreateSubject();
Expand Down
6 changes: 4 additions & 2 deletions tests/MongoDB.Driver.Core.Tests/Core/Misc/WireVersionTests.cs
Expand Up @@ -46,7 +46,7 @@ public void GetServerVersionForErrorMessage_should_return_expected_serverVersion
[Fact]
public void SupportedWireRange_should_be_correct()
{
WireVersion.SupportedWireVersionRange.Should().Be(new Range<int>(6, 21));
WireVersion.SupportedWireVersionRange.Should().Be(new Range<int>(6, 23));
}

[Fact]
Expand All @@ -59,7 +59,9 @@ public void ToServerVersion_should_throw_if_wireVersion_less_than_0()

[Theory]
[InlineData(99, null, null)]
[InlineData(22, null, null)]
[InlineData(24, null, null)]
[InlineData(23, 7, 2)]
[InlineData(22, 7, 1)]
[InlineData(21, 7, 0)]
[InlineData(20, 6, 3)]
[InlineData(19, 6, 2)]
Expand Down
Expand Up @@ -280,10 +280,11 @@ public void Equals_should_return_true_when_all_fields_are_equal()
[InlineData(new[] { 16, 17 }, true)]
[InlineData(new[] { 18, 19 }, true)]
[InlineData(new[] { 19, 20 }, true)]
[InlineData(new[] { 19, 20 }, true)]
[InlineData(new[] { 20, 21 }, true)]
[InlineData(new[] { 21, 22 }, true)]
[InlineData(new[] { 22, 23 }, false)]
[InlineData(new[] { 22, 23 }, true)]
[InlineData(new[] { 23, 24 }, true)]
[InlineData(new[] { 24, 25 }, false)]
public void IsCompatibleWithDriver_should_return_expected_result(int[] minMaxWireVersions, bool expectedResult)
{
var clusterId = new ClusterId(1);
Expand Down

0 comments on commit fdd2ba5

Please sign in to comment.