Skip to content

Commit 69b58eb

Browse files
committed
CSHARP-5373: Add test that PoolClearedEvent is emitted before ConnectionCheckedInEvent/ConnectionCheckOutFailedEvent
1 parent 1085a9d commit 69b58eb

File tree

6 files changed

+1083
-0
lines changed

6 files changed

+1083
-0
lines changed
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+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
description: pool-clear-application-error
3+
4+
schemaVersion: "1.4"
5+
6+
runOnRequirements:
7+
# failCommand appName requirements
8+
- minServerVersion: "4.4"
9+
serverless: forbid
10+
topologies: [ single, replicaset, sharded ]
11+
12+
createEntities:
13+
- client:
14+
id: &setupClient setupClient
15+
useMultipleMongoses: false
16+
17+
initialData: &initialData
18+
- collectionName: &collectionName find-network-error
19+
databaseName: &databaseName sdam-tests
20+
documents:
21+
- _id: 1
22+
- _id: 2
23+
24+
tests:
25+
- description: Pool is cleared before application connection is checked into the pool
26+
operations:
27+
- name: failPoint
28+
object: testRunner
29+
arguments:
30+
client: *setupClient
31+
failPoint:
32+
configureFailPoint: failCommand
33+
mode:
34+
times: 1
35+
data:
36+
failCommands:
37+
- find
38+
closeConnection: true
39+
appName: findNetworkErrorTest
40+
- name: createEntities
41+
object: testRunner
42+
arguments:
43+
entities:
44+
- client:
45+
id: &client client
46+
useMultipleMongoses: false
47+
observeEvents:
48+
- poolClearedEvent
49+
- connectionCheckedInEvent
50+
uriOptions:
51+
retryWrites: false
52+
retryReads: false
53+
appname: findNetworkErrorTest
54+
- database:
55+
id: &database database
56+
client: *client
57+
databaseName: *databaseName
58+
- collection:
59+
id: &collection collection
60+
database: *database
61+
collectionName: *collectionName
62+
- name: find
63+
object: *collection
64+
arguments:
65+
filter:
66+
_id: 1
67+
expectError:
68+
isError: true
69+
- name: waitForEvent
70+
object: testRunner
71+
arguments:
72+
client: *client
73+
event:
74+
poolClearedEvent: {}
75+
count: 1
76+
- name: waitForEvent
77+
object: testRunner
78+
arguments:
79+
client: *client
80+
event:
81+
connectionCheckedInEvent: {}
82+
count: 1
83+
expectEvents:
84+
- client: *client
85+
eventType: cmap
86+
events:
87+
- poolClearedEvent: {}
88+
- connectionCheckedInEvent: {}

0 commit comments

Comments
 (0)