Skip to content

Commit 5bd16e2

Browse files
authored
chore: sync connectTimeoutMS SDAM spec test
NODE-2661
1 parent 603d445 commit 5bd16e2

File tree

2 files changed

+236
-0
lines changed

2 files changed

+236
-0
lines changed
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.4"
5+
}
6+
],
7+
"database_name": "sdam-tests",
8+
"collection_name": "connectTimeoutMS",
9+
"data": [],
10+
"tests": [
11+
{
12+
"description": "connectTimeoutMS=0",
13+
"clientOptions": {
14+
"retryWrites": false,
15+
"connectTimeoutMS": 0,
16+
"heartbeatFrequencyMS": 500,
17+
"appname": "connectTimeoutMS=0"
18+
},
19+
"operations": [
20+
{
21+
"name": "insertMany",
22+
"object": "collection",
23+
"arguments": {
24+
"documents": [
25+
{
26+
"_id": 1
27+
},
28+
{
29+
"_id": 2
30+
}
31+
]
32+
}
33+
},
34+
{
35+
"name": "configureFailPoint",
36+
"object": "testRunner",
37+
"arguments": {
38+
"failPoint": {
39+
"configureFailPoint": "failCommand",
40+
"mode": {
41+
"times": 2
42+
},
43+
"data": {
44+
"failCommands": [
45+
"isMaster"
46+
],
47+
"appName": "connectTimeoutMS=0",
48+
"blockConnection": true,
49+
"blockTimeMS": 550
50+
}
51+
}
52+
}
53+
},
54+
{
55+
"name": "wait",
56+
"object": "testRunner",
57+
"arguments": {
58+
"ms": 750
59+
}
60+
},
61+
{
62+
"name": "insertMany",
63+
"object": "collection",
64+
"arguments": {
65+
"documents": [
66+
{
67+
"_id": 3
68+
},
69+
{
70+
"_id": 4
71+
}
72+
]
73+
}
74+
},
75+
{
76+
"name": "assertEventCount",
77+
"object": "testRunner",
78+
"arguments": {
79+
"event": "ServerMarkedUnknownEvent",
80+
"count": 0
81+
}
82+
},
83+
{
84+
"name": "assertEventCount",
85+
"object": "testRunner",
86+
"arguments": {
87+
"event": "PoolClearedEvent",
88+
"count": 0
89+
}
90+
}
91+
],
92+
"expectations": [
93+
{
94+
"command_started_event": {
95+
"command": {
96+
"insert": "connectTimeoutMS",
97+
"documents": [
98+
{
99+
"_id": 1
100+
},
101+
{
102+
"_id": 2
103+
}
104+
]
105+
},
106+
"command_name": "insert",
107+
"database_name": "sdam-tests"
108+
}
109+
},
110+
{
111+
"command_started_event": {
112+
"command": {
113+
"insert": "connectTimeoutMS",
114+
"documents": [
115+
{
116+
"_id": 3
117+
},
118+
{
119+
"_id": 4
120+
}
121+
]
122+
},
123+
"command_name": "insert",
124+
"database_name": "sdam-tests"
125+
}
126+
}
127+
],
128+
"outcome": {
129+
"collection": {
130+
"data": [
131+
{
132+
"_id": 1
133+
},
134+
{
135+
"_id": 2
136+
},
137+
{
138+
"_id": 3
139+
},
140+
{
141+
"_id": 4
142+
}
143+
]
144+
}
145+
}
146+
}
147+
]
148+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Test SDAM error handling.
2+
runOn:
3+
# failCommand appName requirements
4+
- minServerVersion: "4.4"
5+
6+
database_name: &database_name "sdam-tests"
7+
collection_name: &collection_name "connectTimeoutMS"
8+
9+
data: []
10+
11+
tests:
12+
- description: connectTimeoutMS=0
13+
clientOptions:
14+
retryWrites: false
15+
connectTimeoutMS: 0
16+
heartbeatFrequencyMS: 500
17+
appname: connectTimeoutMS=0
18+
operations:
19+
# Perform an operation to ensure the node is discovered.
20+
- name: insertMany
21+
object: collection
22+
arguments:
23+
documents:
24+
- _id: 1
25+
- _id: 2
26+
# Block the next streaming isMaster check for longer than
27+
# heartbeatFrequencyMS to ensure that the connection timeout remains
28+
# unlimited.
29+
- name: configureFailPoint
30+
object: testRunner
31+
arguments:
32+
failPoint:
33+
configureFailPoint: failCommand
34+
mode: { times: 2 }
35+
data:
36+
failCommands: ["isMaster"]
37+
appName: connectTimeoutMS=0
38+
blockConnection: true
39+
blockTimeMS: 550
40+
- name: wait
41+
object: testRunner
42+
arguments:
43+
ms: 750
44+
# Perform an operation to ensure the node is still selectable.
45+
- name: insertMany
46+
object: collection
47+
arguments:
48+
documents:
49+
- _id: 3
50+
- _id: 4
51+
# Assert that the server was never marked Unknown and the pool was never
52+
# cleared.
53+
- name: assertEventCount
54+
object: testRunner
55+
arguments:
56+
event: ServerMarkedUnknownEvent
57+
count: 0
58+
- name: assertEventCount
59+
object: testRunner
60+
arguments:
61+
event: PoolClearedEvent
62+
count: 0
63+
64+
expectations:
65+
- command_started_event:
66+
command:
67+
insert: *collection_name
68+
documents:
69+
- _id: 1
70+
- _id: 2
71+
command_name: insert
72+
database_name: *database_name
73+
- command_started_event:
74+
command:
75+
insert: *collection_name
76+
documents:
77+
- _id: 3
78+
- _id: 4
79+
command_name: insert
80+
database_name: *database_name
81+
82+
outcome:
83+
collection:
84+
data:
85+
- {_id: 1}
86+
- {_id: 2}
87+
- {_id: 3}
88+
- {_id: 4}

0 commit comments

Comments
 (0)