Skip to content

Commit 83a6b8a

Browse files
committed
replace test
1 parent 6ab2307 commit 83a6b8a

File tree

3 files changed

+96
-56
lines changed

3 files changed

+96
-56
lines changed

pymongo/asynchronous/topology.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,9 @@ async def _handle_error(self, address: _Address, err_ctx: _ErrorContext) -> None
887887
# Unknown command error during the connection handshake.
888888
if not self._settings.load_balanced:
889889
await self._process_change(ServerDescription(address, error=error))
890-
# # Clear the pool if the backpressure label was not applied.
891-
# if not error.has_error_label("SystemOverloadedError"):
892-
# await server.reset(service_id)
890+
# Clear the pool if the backpressure label was not applied.
891+
if not error.has_error_label("SystemOverloadedError"):
892+
await server.reset(service_id)
893893
elif isinstance(error, ConnectionFailure):
894894
if isinstance(error, WaitQueueTimeoutError) or (
895895
error.has_error_label("SystemOverloadedError")

pymongo/synchronous/topology.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,9 +885,9 @@ def _handle_error(self, address: _Address, err_ctx: _ErrorContext) -> None:
885885
# Unknown command error during the connection handshake.
886886
if not self._settings.load_balanced:
887887
self._process_change(ServerDescription(address, error=error))
888-
# # Clear the pool if the backpressure label was not applied.
889-
# if not error.has_error_label("SystemOverloadedError"):
890-
# server.reset(service_id)
888+
# Clear the pool if the backpressure label was not applied.
889+
if not error.has_error_label("SystemOverloadedError"):
890+
server.reset(service_id)
891891
elif isinstance(error, ConnectionFailure):
892892
if isinstance(error, WaitQueueTimeoutError) or (
893893
error.has_error_label("SystemOverloadedError")

test/discovery_and_monitoring/unified/backpressure-hello-command-error.json renamed to test/discovery_and_monitoring/unified/backpressure-auth-error.json

Lines changed: 90 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"description": "backpressure hello-command-error",
2+
"description": "auth-error",
33
"schemaVersion": "1.17",
44
"runOnRequirements": [
55
{
6-
"minServerVersion": "4.4.7",
6+
"minServerVersion": "4.4",
7+
"auth": true,
78
"serverless": "forbid",
89
"topologies": [
910
"single",
@@ -22,15 +23,45 @@
2223
],
2324
"initialData": [
2425
{
25-
"collectionName": "backpressure hello-command-error",
26+
"collectionName": "auth-error",
2627
"databaseName": "sdam-tests",
27-
"documents": []
28+
"documents": [
29+
{
30+
"_id": 1
31+
},
32+
{
33+
"_id": 2
34+
}
35+
]
2836
}
2937
],
3038
"tests": [
3139
{
32-
"description": "hello command error with backpressure label does not clear the pool",
40+
"description": "does not reset the server or clear the pool after AuthenticationFailure error with backpressure label",
3341
"operations": [
42+
{
43+
"name": "failPoint",
44+
"object": "testRunner",
45+
"arguments": {
46+
"client": "setupClient",
47+
"failPoint": {
48+
"configureFailPoint": "failCommand",
49+
"mode": {
50+
"times": 1
51+
},
52+
"data": {
53+
"failCommands": [
54+
"saslContinue"
55+
],
56+
"appName": "authErrorTest",
57+
"errorCode": 18,
58+
"errorLabels": [
59+
"SystemOverloadedError"
60+
]
61+
}
62+
}
63+
}
64+
},
3465
{
3566
"name": "createEntities",
3667
"object": "testRunner",
@@ -41,17 +72,13 @@
4172
"id": "client",
4273
"useMultipleMongoses": false,
4374
"observeEvents": [
44-
"serverHeartbeatSucceededEvent",
45-
"poolClearedEvent",
75+
"commandStartedEvent",
4676
"poolReadyEvent",
47-
"commandStartedEvent"
77+
"poolClearedEvent"
4878
],
4979
"uriOptions": {
5080
"retryWrites": false,
51-
"heartbeatFrequencyMS": 10000,
52-
"serverMonitoringMode": "poll",
53-
"directConnection": true,
54-
"appname": "backpressureCommandErrorHandshakeTest"
81+
"appname": "authErrorTest"
5582
}
5683
}
5784
},
@@ -66,44 +93,27 @@
6693
"collection": {
6794
"id": "collection",
6895
"database": "database",
69-
"collectionName": "backpressure hello-command-error"
96+
"collectionName": "auth-error"
7097
}
7198
}
7299
]
73100
}
74101
},
75102
{
76-
"name": "waitForEvent",
77-
"object": "testRunner",
78-
"arguments": {
79-
"client": "client",
80-
"event": {
81-
"serverHeartbeatSucceededEvent": {}
82-
},
83-
"count": 1
84-
}
85-
},
86-
{
87-
"name": "failPoint",
88-
"object": "testRunner",
103+
"name": "insertMany",
104+
"object": "collection",
89105
"arguments": {
90-
"client": "setupClient",
91-
"failPoint": {
92-
"configureFailPoint": "failCommand",
93-
"mode": "alwaysOn",
94-
"data": {
95-
"failCommands": [
96-
"hello",
97-
"isMaster"
98-
],
99-
"appName": "backpressureCommandErrorHandshakeTest",
100-
"closeConnection": false,
101-
"errorCode": 9001,
102-
"errorLabels": [
103-
"SystemOverloadedError"
104-
]
106+
"documents": [
107+
{
108+
"_id": 3
109+
},
110+
{
111+
"_id": 4
105112
}
106-
}
113+
]
114+
},
115+
"expectError": {
116+
"isError": true
107117
}
108118
},
109119
{
@@ -112,15 +122,12 @@
112122
"arguments": {
113123
"documents": [
114124
{
115-
"_id": 1
125+
"_id": 5
116126
},
117127
{
118-
"_id": 2
128+
"_id": 6
119129
}
120130
]
121-
},
122-
"expectError": {
123-
"isError": true
124131
}
125132
}
126133
],
@@ -136,11 +143,44 @@
136143
},
137144
{
138145
"client": "client",
139-
"eventType": "sdam",
140-
"ignoreExtraEvents": false,
146+
"eventType": "command",
141147
"events": [
142148
{
143-
"serverHeartbeatSucceededEvent": {}
149+
"commandStartedEvent": {
150+
"command": {
151+
"insert": "auth-error",
152+
"documents": [
153+
{
154+
"_id": 5
155+
},
156+
{
157+
"_id": 6
158+
}
159+
]
160+
},
161+
"commandName": "insert",
162+
"databaseName": "sdam-tests"
163+
}
164+
}
165+
]
166+
}
167+
],
168+
"outcome": [
169+
{
170+
"collectionName": "auth-error",
171+
"databaseName": "sdam-tests",
172+
"documents": [
173+
{
174+
"_id": 1
175+
},
176+
{
177+
"_id": 2
178+
},
179+
{
180+
"_id": 5
181+
},
182+
{
183+
"_id": 6
144184
}
145185
]
146186
}

0 commit comments

Comments
 (0)