Skip to content

Commit

Permalink
CSHARP-4364: Bump maxWireVersion for MongoDB 6.1. (#903)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryLukyanov committed Oct 14, 2022
1 parent 627b791 commit 554c799
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
9 changes: 7 additions & 2 deletions src/MongoDB.Driver.Core/Core/Misc/WireVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ internal static class WireVersion
/// Wire version 17.
/// </summary>
public const int Server60 = 17;
/// <summary>
/// Wire version 18.
/// </summary>
public const int Server61 = 18;

#region static
private static List<WireVersionInfo> __knownWireVersions = new()
Expand All @@ -114,10 +118,11 @@ internal static class WireVersion
new WireVersionInfo(wireVersion: 14, major: 5, minor: 1),
new WireVersionInfo(wireVersion: 15, major: 5, minor: 2),
new WireVersionInfo(wireVersion: 16, major: 5, minor: 3),
new WireVersionInfo(wireVersion: 17, major: 6, minor: 0)
new WireVersionInfo(wireVersion: 17, major: 6, minor: 0),
new WireVersionInfo(wireVersion: 18, major: 6, minor: 1)
};

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

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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void SupportedWireVersionRange_should_return_expected_result()
{
var result = Cluster.SupportedWireVersionRange;

result.Should().Be(new Range<int>(6, 17));
result.Should().Be(new Range<int>(6, 18));
}

[Fact]
Expand Down Expand Up @@ -328,8 +328,8 @@ public void AcquireServerSession_should_call_serverSessionPool_AcquireSession()
[Theory]
[InlineData(0, 0, false)]
[InlineData(0, 0, true)]
[InlineData(18, 19, false)]
[InlineData(18, 19, true)]
[InlineData(19, 20, false)]
[InlineData(19, 20, true)]
public void SelectServer_should_throw_if_any_servers_are_incompatible(int min, int max, bool async)
{
var subject = CreateSubject();
Expand Down
6 changes: 3 additions & 3 deletions tests/MongoDB.Driver.Core.Tests/Core/Misc/WireVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void Server_maxWireVersion_should_be_in_supported_range()

var isOverlaped = WireVersion.SupportedWireVersionRange.Overlaps(new Range<int>(serverMaxWireVersion, serverMaxWireVersion));

isOverlaped.Should().BeTrue();
isOverlaped.Should().BeTrue($"Server MaxWireVersion: {serverMaxWireVersion} is not in supported range for the driver: {WireVersion.SupportedWireVersionRange}");
}

[Theory]
Expand All @@ -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, 17));
WireVersion.SupportedWireVersionRange.Should().Be(new Range<int>(6, 18));
}

[Fact]
Expand All @@ -60,7 +60,7 @@ public void ToServerVersion_should_throw_if_wireVersion_less_than_0()
[Theory]
[InlineData(99, null, null)]
[InlineData(19, null, null)]
[InlineData(18, null, null)]
[InlineData(18, 6, 1)]
[InlineData(17, 6, 0)]
[InlineData(16, 5, 3)]
[InlineData(15, 5, 2)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ public void Equals_should_return_true_when_all_fields_are_equal()
[InlineData(new[] { 14, 15 }, true)]
[InlineData(new[] { 15, 16 }, true)]
[InlineData(new[] { 16, 17 }, true)]
[InlineData(new[] { 18, 19 }, false)]
[InlineData(new[] { 18, 19 }, true)]
[InlineData(new[] { 19, 20 }, false)]
public void IsCompatibleWithDriver_should_return_expected_result(int[] minMaxWireVersions, bool expectedResult)
{
var clusterId = new ClusterId(1);
Expand Down

0 comments on commit 554c799

Please sign in to comment.