Skip to content

Commit 27a9f47

Browse files
authored
PYTHON-5696 Fix racy backpressure-network tests (#2678)
1 parent 84699d2 commit 27a9f47

4 files changed

Lines changed: 302 additions & 11 deletions
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"description": "backpressure-network-error-fail-replicaset",
3+
"schemaVersion": "1.17",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.4",
7+
"serverless": "forbid",
8+
"topologies": [
9+
"replicaset"
10+
]
11+
}
12+
],
13+
"createEntities": [
14+
{
15+
"client": {
16+
"id": "setupClient",
17+
"useMultipleMongoses": false
18+
}
19+
}
20+
],
21+
"initialData": [
22+
{
23+
"collectionName": "backpressure-network-error-fail",
24+
"databaseName": "sdam-tests",
25+
"documents": [
26+
{
27+
"_id": 1
28+
},
29+
{
30+
"_id": 2
31+
}
32+
]
33+
}
34+
],
35+
"tests": [
36+
{
37+
"description": "apply backpressure on network connection errors during connection establishment",
38+
"operations": [
39+
{
40+
"name": "createEntities",
41+
"object": "testRunner",
42+
"arguments": {
43+
"entities": [
44+
{
45+
"client": {
46+
"id": "client",
47+
"useMultipleMongoses": false,
48+
"observeEvents": [
49+
"serverDescriptionChangedEvent",
50+
"poolClearedEvent"
51+
],
52+
"uriOptions": {
53+
"retryWrites": false,
54+
"heartbeatFrequencyMS": 1000000,
55+
"serverMonitoringMode": "poll",
56+
"appname": "backpressureNetworkErrorFailTest"
57+
}
58+
}
59+
},
60+
{
61+
"database": {
62+
"id": "database",
63+
"client": "client",
64+
"databaseName": "sdam-tests"
65+
}
66+
},
67+
{
68+
"collection": {
69+
"id": "collection",
70+
"database": "database",
71+
"collectionName": "backpressure-network-error-fail"
72+
}
73+
}
74+
]
75+
}
76+
},
77+
{
78+
"name": "waitForEvent",
79+
"object": "testRunner",
80+
"arguments": {
81+
"client": "client",
82+
"event": {
83+
"serverDescriptionChangedEvent": {
84+
"newDescription": {
85+
"type": "RSPrimary"
86+
}
87+
}
88+
},
89+
"count": 1
90+
}
91+
},
92+
{
93+
"name": "failPoint",
94+
"object": "testRunner",
95+
"arguments": {
96+
"client": "setupClient",
97+
"failPoint": {
98+
"configureFailPoint": "failCommand",
99+
"mode": "alwaysOn",
100+
"data": {
101+
"failCommands": [
102+
"isMaster",
103+
"hello"
104+
],
105+
"appName": "backpressureNetworkErrorFailTest",
106+
"closeConnection": true
107+
}
108+
}
109+
}
110+
},
111+
{
112+
"name": "insertMany",
113+
"object": "collection",
114+
"arguments": {
115+
"documents": [
116+
{
117+
"_id": 3
118+
},
119+
{
120+
"_id": 4
121+
}
122+
]
123+
},
124+
"expectError": {
125+
"isError": true,
126+
"errorLabelsContain": [
127+
"SystemOverloadedError",
128+
"RetryableError"
129+
]
130+
}
131+
}
132+
],
133+
"expectEvents": [
134+
{
135+
"client": "client",
136+
"eventType": "cmap",
137+
"events": []
138+
}
139+
]
140+
}
141+
]
142+
}

test/discovery_and_monitoring/unified/backpressure-network-error-fail.json renamed to test/discovery_and_monitoring/unified/backpressure-network-error-fail-single.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{
2-
"description": "backpressure-network-error-fail",
2+
"description": "backpressure-network-error-fail-single",
33
"schemaVersion": "1.17",
44
"runOnRequirements": [
55
{
66
"minServerVersion": "4.4",
77
"serverless": "forbid",
88
"topologies": [
9-
"single",
10-
"replicaset",
11-
"sharded"
9+
"single"
1210
]
1311
}
1412
],
@@ -48,7 +46,7 @@
4846
"id": "client",
4947
"useMultipleMongoses": false,
5048
"observeEvents": [
51-
"serverHeartbeatSucceededEvent",
49+
"serverDescriptionChangedEvent",
5250
"poolClearedEvent"
5351
],
5452
"uriOptions": {
@@ -82,7 +80,11 @@
8280
"arguments": {
8381
"client": "client",
8482
"event": {
85-
"serverHeartbeatSucceededEvent": {}
83+
"serverDescriptionChangedEvent": {
84+
"newDescription": {
85+
"type": "Standalone"
86+
}
87+
}
8688
},
8789
"count": 1
8890
}
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{
2+
"description": "backpressure-network-timeout-error-replicaset",
3+
"schemaVersion": "1.17",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.4",
7+
"serverless": "forbid",
8+
"topologies": [
9+
"replicaset"
10+
]
11+
}
12+
],
13+
"createEntities": [
14+
{
15+
"client": {
16+
"id": "setupClient",
17+
"useMultipleMongoses": false
18+
}
19+
}
20+
],
21+
"initialData": [
22+
{
23+
"collectionName": "backpressure-network-timeout-error",
24+
"databaseName": "sdam-tests",
25+
"documents": [
26+
{
27+
"_id": 1
28+
},
29+
{
30+
"_id": 2
31+
}
32+
]
33+
}
34+
],
35+
"tests": [
36+
{
37+
"description": "apply backpressure on network timeout error during connection establishment",
38+
"operations": [
39+
{
40+
"name": "createEntities",
41+
"object": "testRunner",
42+
"arguments": {
43+
"entities": [
44+
{
45+
"client": {
46+
"id": "client",
47+
"useMultipleMongoses": false,
48+
"observeEvents": [
49+
"serverDescriptionChangedEvent",
50+
"poolClearedEvent"
51+
],
52+
"uriOptions": {
53+
"retryWrites": false,
54+
"heartbeatFrequencyMS": 1000000,
55+
"appname": "backpressureNetworkTimeoutErrorTest",
56+
"serverMonitoringMode": "poll",
57+
"connectTimeoutMS": 250,
58+
"socketTimeoutMS": 250
59+
}
60+
}
61+
},
62+
{
63+
"database": {
64+
"id": "database",
65+
"client": "client",
66+
"databaseName": "sdam-tests"
67+
}
68+
},
69+
{
70+
"collection": {
71+
"id": "collection",
72+
"database": "database",
73+
"collectionName": "backpressure-network-timeout-error"
74+
}
75+
}
76+
]
77+
}
78+
},
79+
{
80+
"name": "waitForEvent",
81+
"object": "testRunner",
82+
"arguments": {
83+
"client": "client",
84+
"event": {
85+
"serverDescriptionChangedEvent": {
86+
"newDescription": {
87+
"type": "RSPrimary"
88+
}
89+
}
90+
},
91+
"count": 1
92+
}
93+
},
94+
{
95+
"name": "failPoint",
96+
"object": "testRunner",
97+
"arguments": {
98+
"client": "setupClient",
99+
"failPoint": {
100+
"configureFailPoint": "failCommand",
101+
"mode": "alwaysOn",
102+
"data": {
103+
"failCommands": [
104+
"isMaster",
105+
"hello"
106+
],
107+
"blockConnection": true,
108+
"blockTimeMS": 500,
109+
"appName": "backpressureNetworkTimeoutErrorTest"
110+
}
111+
}
112+
}
113+
},
114+
{
115+
"name": "insertMany",
116+
"object": "collection",
117+
"arguments": {
118+
"documents": [
119+
{
120+
"_id": 3
121+
},
122+
{
123+
"_id": 4
124+
}
125+
]
126+
},
127+
"expectError": {
128+
"isError": true,
129+
"errorLabelsContain": [
130+
"SystemOverloadedError",
131+
"RetryableError"
132+
]
133+
}
134+
}
135+
],
136+
"expectEvents": [
137+
{
138+
"client": "client",
139+
"eventType": "cmap",
140+
"events": []
141+
}
142+
]
143+
}
144+
]
145+
}

test/discovery_and_monitoring/unified/backpressure-network-timeout-fail.json renamed to test/discovery_and_monitoring/unified/backpressure-network-timeout-fail-single.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{
2-
"description": "backpressure-network-timeout-error",
2+
"description": "backpressure-network-timeout-error-single",
33
"schemaVersion": "1.17",
44
"runOnRequirements": [
55
{
66
"minServerVersion": "4.4",
77
"serverless": "forbid",
88
"topologies": [
9-
"single",
10-
"replicaset",
11-
"sharded"
9+
"single"
1210
]
1311
}
1412
],
@@ -84,7 +82,11 @@
8482
"arguments": {
8583
"client": "client",
8684
"event": {
87-
"serverDescriptionChangedEvent": {}
85+
"serverDescriptionChangedEvent": {
86+
"newDescription": {
87+
"type": "Standalone"
88+
}
89+
}
8890
},
8991
"count": 1
9092
}

0 commit comments

Comments
 (0)