Skip to content

Commit 07d1e63

Browse files
committed
add new tests
1 parent 30cadb3 commit 07d1e63

File tree

4 files changed

+297
-2
lines changed

4 files changed

+297
-2
lines changed

test/asynchronous/test_pooling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ async def test_connection_timeout_message(self):
515515
)
516516

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

test/test_pooling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def test_connection_timeout_message(self):
513513
)
514514

515515
@client_context.require_failCommand_appName
516-
def test_pool_backoff_preserves_existing_connections(self):
516+
def test_pool_backpressure_preserves_existing_connections(self):
517517
client = self.rs_or_single_client()
518518
coll = self.db.t
519519
pool = get_pool(client)

0 commit comments

Comments
 (0)