From 80019f60cd1972057bf68593eef0c1ebb97eb0b8 Mon Sep 17 00:00:00 2001 From: Oleksandr Poliakov Date: Wed, 18 Mar 2026 10:05:09 -0700 Subject: [PATCH] CSHARP-5871: Clarify phase description for "Network timeouts test" spec test --- .../tests/errors/error_handling_handshake.json | 18 +++++++++++++----- .../tests/errors/error_handling_handshake.yml | 15 ++++----------- .../ServerDiscoveryAndMonitoringTestRunner.cs | 1 + 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/specifications/server-discovery-and-monitoring/tests/errors/error_handling_handshake.json b/specifications/server-discovery-and-monitoring/tests/errors/error_handling_handshake.json index 56ca7d11328..c60ee453dd3 100644 --- a/specifications/server-discovery-and-monitoring/tests/errors/error_handling_handshake.json +++ b/specifications/server-discovery-and-monitoring/tests/errors/error_handling_handshake.json @@ -85,7 +85,7 @@ } }, { - "description": "Mark server unknown on network timeout application error (beforeHandshakeCompletes)", + "description": "Ignore network timeout application error (beforeHandshakeCompletes)", "applicationErrors": [ { "address": "a:27017", @@ -97,14 +97,22 @@ "outcome": { "servers": { "a:27017": { - "type": "Unknown", - "topologyVersion": null, + "type": "RSPrimary", + "setName": "rs", + "topologyVersion": { + "processId": { + "$oid": "000000000000000000000001" + }, + "counter": { + "$numberLong": "1" + } + }, "pool": { - "generation": 1 + "generation": 0 } } }, - "topologyType": "ReplicaSetNoPrimary", + "topologyType": "ReplicaSetWithPrimary", "logicalSessionTimeoutMinutes": null, "setName": "rs" } diff --git a/specifications/server-discovery-and-monitoring/tests/errors/error_handling_handshake.yml b/specifications/server-discovery-and-monitoring/tests/errors/error_handling_handshake.yml index 8482ea704c2..42cfa60509c 100644 --- a/specifications/server-discovery-and-monitoring/tests/errors/error_handling_handshake.yml +++ b/specifications/server-discovery-and-monitoring/tests/errors/error_handling_handshake.yml @@ -37,19 +37,12 @@ phases: type: timeout outcome: *outcome -- description: Mark server unknown on network timeout application error (beforeHandshakeCompletes) +- description: Ignore network timeout application error (beforeHandshakeCompletes) + # The test runner may need to add the SystemOverloadedError label for the pre-handshake network timeout. + # The SystemOverloadedError label causes the error to be ignored. applicationErrors: - address: a:27017 when: beforeHandshakeCompletes maxWireVersion: 9 type: timeout - outcome: - servers: - a:27017: - type: Unknown - topologyVersion: null - pool: - generation: 1 - topologyType: ReplicaSetNoPrimary - logicalSessionTimeoutMinutes: null - setName: rs + outcome: *outcome \ No newline at end of file diff --git a/tests/MongoDB.Driver.Tests/Specifications/server-discovery-and-monitoring/ServerDiscoveryAndMonitoringTestRunner.cs b/tests/MongoDB.Driver.Tests/Specifications/server-discovery-and-monitoring/ServerDiscoveryAndMonitoringTestRunner.cs index 9fc61009e7b..62da51346e7 100644 --- a/tests/MongoDB.Driver.Tests/Specifications/server-discovery-and-monitoring/ServerDiscoveryAndMonitoringTestRunner.cs +++ b/tests/MongoDB.Driver.Tests/Specifications/server-discovery-and-monitoring/ServerDiscoveryAndMonitoringTestRunner.cs @@ -103,6 +103,7 @@ private void ApplyApplicationError(BsonDocument applicationError) { var innerException = CoreExceptionHelper.CreateException("IOExceptionWithTimedOutSocketException"); simulatedException = new MongoConnectionException(connectionId, "Chaos, yet harmony.", innerException); + ((MongoConnectionException)simulatedException).AddErrorLabel("SystemOverloadedError"); break; } default: