Skip to content

CSHARP-4965: Bump maxWireVersion for MongoDB 7.2 #1266

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/MongoDB.Driver.Core/Core/Misc/WireVersion.cs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 SelectServer_should_throw_if_the_matched_server_cannot_be_found_and_
[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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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