Skip to content

Commit 2a34053

Browse files
committed
PYTHON-4918 Add test that PoolClearedEvent is emitted before ConnectionCheckedInEvent/ConnectionCheckOutFailedEvent
1 parent 1e67c5c commit 2a34053

File tree

6 files changed

+682
-31
lines changed

6 files changed

+682
-31
lines changed

.evergreen/remove-unimplemented-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ rm $PYMONGO/test/client-side-encryption/spec/unified/localSchema.json # PYTHON-
99
rm $PYMONGO/test/client-side-encryption/spec/unified/maxWireVersion.json # PYTHON-5143
1010
rm $PYMONGO/test/unified-test-format/valid-pass/poc-queryable-encryption.json # PYTHON-5143
1111
rm $PYMONGO/test/gridfs/rename.json # PYTHON-4931
12-
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-application-error.json # PYTHON-4918
13-
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-checkout-error.json # PYTHON-4918
14-
rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-min-pool-size-error.json # PYTHON-4918
12+
#rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-application-error.json # PYTHON-4918
13+
#rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-checkout-error.json # PYTHON-4918
14+
#rm $PYMONGO/test/discovery_and_monitoring/unified/pool-clear-min-pool-size-error.json # PYTHON-4918
1515

1616
# Python doesn't implement DRIVERS-3064
1717
rm $PYMONGO/test/collection_management/listCollections-rawdata.json

.evergreen/spec-patch/PYTHON-4918.patch

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/connection_monitoring/pool-create-min-size-error.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@
4949
"type": "ConnectionCreated",
5050
"address": 42
5151
},
52+
{
53+
"type": "ConnectionPoolCleared",
54+
"address": 42
55+
},
5256
{
5357
"type": "ConnectionClosed",
5458
"address": 42,
5559
"connectionId": 42,
5660
"reason": "error"
57-
},
58-
{
59-
"type": "ConnectionPoolCleared",
60-
"address": 42
6161
}
6262
],
6363
"ignore": [
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
{
2+
"description": "pool-clear-application-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": "find-network-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": "Pool is cleared before application connection is checked into the pool",
40+
"operations": [
41+
{
42+
"name": "failPoint",
43+
"object": "testRunner",
44+
"arguments": {
45+
"client": "setupClient",
46+
"failPoint": {
47+
"configureFailPoint": "failCommand",
48+
"mode": {
49+
"times": 1
50+
},
51+
"data": {
52+
"failCommands": [
53+
"find"
54+
],
55+
"closeConnection": true,
56+
"appName": "findNetworkErrorTest"
57+
}
58+
}
59+
}
60+
},
61+
{
62+
"name": "createEntities",
63+
"object": "testRunner",
64+
"arguments": {
65+
"entities": [
66+
{
67+
"client": {
68+
"id": "client",
69+
"useMultipleMongoses": false,
70+
"observeEvents": [
71+
"poolClearedEvent",
72+
"connectionCheckedInEvent"
73+
],
74+
"uriOptions": {
75+
"retryWrites": false,
76+
"retryReads": false,
77+
"appname": "findNetworkErrorTest"
78+
}
79+
}
80+
},
81+
{
82+
"database": {
83+
"id": "database",
84+
"client": "client",
85+
"databaseName": "sdam-tests"
86+
}
87+
},
88+
{
89+
"collection": {
90+
"id": "collection",
91+
"database": "database",
92+
"collectionName": "find-network-error"
93+
}
94+
}
95+
]
96+
}
97+
},
98+
{
99+
"name": "find",
100+
"object": "collection",
101+
"arguments": {
102+
"filter": {
103+
"_id": 1
104+
}
105+
},
106+
"expectError": {
107+
"isError": true
108+
}
109+
},
110+
{
111+
"name": "waitForEvent",
112+
"object": "testRunner",
113+
"arguments": {
114+
"client": "client",
115+
"event": {
116+
"poolClearedEvent": {}
117+
},
118+
"count": 1
119+
}
120+
},
121+
{
122+
"name": "waitForEvent",
123+
"object": "testRunner",
124+
"arguments": {
125+
"client": "client",
126+
"event": {
127+
"connectionCheckedInEvent": {}
128+
},
129+
"count": 1
130+
}
131+
}
132+
],
133+
"expectEvents": [
134+
{
135+
"client": "client",
136+
"eventType": "cmap",
137+
"events": [
138+
{
139+
"poolClearedEvent": {}
140+
},
141+
{
142+
"connectionCheckedInEvent": {}
143+
}
144+
]
145+
}
146+
]
147+
}
148+
]
149+
}

0 commit comments

Comments
 (0)