Skip to content

Commit 1e6973b

Browse files
committed
add error label check and add runOnRequirement
1 parent 09647f0 commit 1e6973b

File tree

7 files changed

+47
-6
lines changed

7 files changed

+47
-6
lines changed

test/asynchronous/unified_format.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,19 @@ async def is_run_on_requirement_satisfied(requirement):
157157
min_version_satisfied = Version.from_string("4.2") <= server_version
158158
csfle_satisfied = _HAVE_PYMONGOCRYPT and min_version_satisfied
159159

160+
pool_backoff_statisfied = True
161+
req_pool_backoff = requirement.get("supportsPoolBackoff")
162+
if req_pool_backoff is False:
163+
pool_backoff_statisfied = False
164+
160165
return (
161166
topology_satisfied
162167
and min_version_satisfied
163168
and max_version_satisfied
164169
and params_satisfied
165170
and auth_satisfied
166171
and csfle_satisfied
172+
and pool_backoff_statisfied
167173
)
168174

169175

test/discovery_and_monitoring/unified/backoff-heartbeat-failure.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{
66
"minServerVersion": "4.4",
77
"serverless": "forbid",
8+
"supportsPoolBackoff": true,
89
"topologies": [
910
"single",
1011
"replicaset",
@@ -123,7 +124,11 @@
123124
]
124125
},
125126
"expectError": {
126-
"isError": true
127+
"isError": true,
128+
"errorLabelsContain": [
129+
"SystemOverloadedError",
130+
"RetryableError"
131+
]
127132
}
128133
},
129134
{

test/discovery_and_monitoring/unified/backoff-heartbeat-success.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{
66
"minServerVersion": "4.4",
77
"serverless": "forbid",
8+
"supportsPoolBackoff": true,
89
"topologies": [
910
"single",
1011
"replicaset",
@@ -123,7 +124,11 @@
123124
]
124125
},
125126
"expectError": {
126-
"isError": true
127+
"isError": true,
128+
"errorLabelsContain": [
129+
"SystemOverloadedError",
130+
"RetryableError"
131+
]
127132
}
128133
},
129134
{

test/discovery_and_monitoring/unified/backoff-network-error-fail.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{
66
"minServerVersion": "4.4",
77
"serverless": "forbid",
8+
"supportsPoolBackoff": true,
89
"topologies": [
910
"single",
1011
"replicaset",
@@ -123,7 +124,11 @@
123124
]
124125
},
125126
"expectError": {
126-
"isError": true
127+
"isError": true,
128+
"errorLabelsContain": [
129+
"SystemOverloadedError",
130+
"RetryableError"
131+
]
127132
}
128133
},
129134
{
@@ -244,7 +249,11 @@
244249
]
245250
},
246251
"expectError": {
247-
"isError": true
252+
"isError": true,
253+
"errorLabelsContain": [
254+
"SystemOverloadedError",
255+
"RetryableError"
256+
]
248257
}
249258
},
250259
{

test/discovery_and_monitoring/unified/backoff-network-error.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{
66
"minServerVersion": "4.4",
77
"serverless": "forbid",
8+
"supportsPoolBackoff": true,
89
"topologies": [
910
"single",
1011
"replicaset",
@@ -127,7 +128,11 @@
127128
]
128129
},
129130
"expectError": {
130-
"isError": true
131+
"isError": true,
132+
"errorLabelsContain": [
133+
"SystemOverloadedError",
134+
"RetryableError"
135+
]
131136
}
132137
},
133138
{

test/discovery_and_monitoring/unified/backoff-network-timeout-error.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{
66
"minServerVersion": "4.4",
77
"serverless": "forbid",
8+
"supportsPoolBackoff": true,
89
"topologies": [
910
"single",
1011
"replicaset",
@@ -127,7 +128,11 @@
127128
]
128129
},
129130
"expectError": {
130-
"isError": true
131+
"isError": true,
132+
"errorLabelsContain": [
133+
"SystemOverloadedError",
134+
"RetryableError"
135+
]
131136
}
132137
},
133138
{

test/unified_format.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,19 @@ def is_run_on_requirement_satisfied(requirement):
156156
min_version_satisfied = Version.from_string("4.2") <= server_version
157157
csfle_satisfied = _HAVE_PYMONGOCRYPT and min_version_satisfied
158158

159+
pool_backoff_statisfied = True
160+
req_pool_backoff = requirement.get("supportsPoolBackoff")
161+
if req_pool_backoff is False:
162+
pool_backoff_statisfied = False
163+
159164
return (
160165
topology_satisfied
161166
and min_version_satisfied
162167
and max_version_satisfied
163168
and params_satisfied
164169
and auth_satisfied
165170
and csfle_satisfied
171+
and pool_backoff_statisfied
166172
)
167173

168174

0 commit comments

Comments
 (0)