...
1# Test SDAM error handling.
2runOn:
3 # failCommand appName requirements
4 - minServerVersion: "4.4"
5
6database_name: &database_name "sdam-tests"
7collection_name: &collection_name "hello-timeout"
8
9data: []
10
11tests:
12 - description: Network timeout on Monitor handshake
13 # Configure the initial handshake to fail with a timeout.
14 # Use times: 2 so that the RTT hello is blocked as well.
15 failPoint:
16 configureFailPoint: failCommand
17 mode: { times: 2 }
18 data:
19 failCommands: ["hello", "isMaster"]
20 appName: timeoutMonitorHandshakeTest
21 blockConnection: true
22 blockTimeMS: 1000
23 clientOptions:
24 retryWrites: false
25 connectTimeoutMS: 250
26 heartbeatFrequencyMS: 500
27 appname: timeoutMonitorHandshakeTest
28 operations:
29 # The network error on the initial handshake should mark the server
30 # Unknown (emitting a ServerDescriptionChangedEvent) and clear the pool.
31 - name: waitForEvent
32 object: testRunner
33 arguments:
34 event: ServerMarkedUnknownEvent
35 count: 1
36 # Perform an operation to ensure the node is discovered.
37 - name: insertMany
38 object: collection
39 arguments:
40 documents:
41 - _id: 1
42 - _id: 2
43 # We cannot assert the server was marked Unknown and pool was cleared an
44 # exact number of times because the RTT hello may or may not have
45 # triggered this failpoint as well.
46 # - name: assertEventCount
47 # object: testRunner
48 # arguments:
49 # event: ServerMarkedUnknownEvent
50 # count: 1
51 # - name: assertEventCount
52 # object: testRunner
53 # arguments:
54 # event: PoolClearedEvent
55 # count: 1
56
57 expectations:
58 - command_started_event:
59 command:
60 insert: *collection_name
61 documents:
62 - _id: 1
63 - _id: 2
64 command_name: insert
65 database_name: *database_name
66
67 outcome:
68 collection:
69 data:
70 - {_id: 1}
71 - {_id: 2}
72
73 - description: Network timeout on Monitor check
74 clientOptions:
75 retryWrites: false
76 connectTimeoutMS: 750
77 heartbeatFrequencyMS: 500
78 appname: timeoutMonitorCheckTest
79 operations:
80 # Perform an operation to ensure the node is discovered.
81 - name: insertMany
82 object: collection
83 arguments:
84 documents:
85 - _id: 1
86 - _id: 2
87 # Configure the next streaming hello check to fail with a timeout.
88 # Use "times: 4" to increase the probability that the Monitor check times
89 # out since the RTT hello may trigger this failpoint one or many times as
90 # well.
91 - name: configureFailPoint
92 object: testRunner
93 arguments:
94 failPoint:
95 configureFailPoint: failCommand
96 mode: { times: 4 }
97 data:
98 failCommands: ["hello", "isMaster"]
99 appName: timeoutMonitorCheckTest
100 blockConnection: true
101 # blockTimeMS is evaluated after the waiting for heartbeatFrequencyMS server-side, so this value only
102 # needs to be greater than connectTimeoutMS. The driver will wait for (500+750)ms and the server will
103 # respond after (500+1000)ms.
104 blockTimeMS: 1000
105 # The network error on the next check should mark the server Unknown and
106 # clear the pool.
107 - name: waitForEvent
108 object: testRunner
109 arguments:
110 event: ServerMarkedUnknownEvent
111 count: 1
112 - name: waitForEvent
113 object: testRunner
114 arguments:
115 event: PoolClearedEvent
116 count: 1
117 # Perform an operation to ensure the node is rediscovered.
118 - name: insertMany
119 object: collection
120 arguments:
121 documents:
122 - _id: 3
123 - _id: 4
124 # We cannot assert the server was marked Unknown and pool was cleared an
125 # exact number of times because the RTT hello may have triggered this
126 # failpoint one or many times as well.
127
128 expectations:
129 - command_started_event:
130 command:
131 insert: *collection_name
132 documents:
133 - _id: 1
134 - _id: 2
135 command_name: insert
136 database_name: *database_name
137 - command_started_event:
138 command:
139 insert: *collection_name
140 documents:
141 - _id: 3
142 - _id: 4
143 command_name: insert
144 database_name: *database_name
145
146 outcome:
147 collection:
148 data:
149 - {_id: 1}
150 - {_id: 2}
151 - {_id: 3}
152 - {_id: 4}
153
154 - description: Driver extends timeout while streaming
155 clientOptions:
156 retryWrites: false
157 connectTimeoutMS: 250
158 heartbeatFrequencyMS: 500
159 appname: extendsTimeoutTest
160 operations:
161 # Perform an operation to ensure the node is discovered.
162 - name: insertMany
163 object: collection
164 arguments:
165 documents:
166 - _id: 1
167 - _id: 2
168 # Wait for multiple monitor checks to complete.
169 - name: wait
170 object: testRunner
171 arguments:
172 ms: 2000
173 # Perform an operation to ensure the node is still selectable.
174 - name: insertMany
175 object: collection
176 arguments:
177 documents:
178 - _id: 3
179 - _id: 4
180 # Assert that the server was never marked Unknown and the pool was never
181 # cleared.
182 - name: assertEventCount
183 object: testRunner
184 arguments:
185 event: ServerMarkedUnknownEvent
186 count: 0
187 - name: assertEventCount
188 object: testRunner
189 arguments:
190 event: PoolClearedEvent
191 count: 0
192
193 expectations:
194 - command_started_event:
195 command:
196 insert: *collection_name
197 documents:
198 - _id: 1
199 - _id: 2
200 command_name: insert
201 database_name: *database_name
202 - command_started_event:
203 command:
204 insert: *collection_name
205 documents:
206 - _id: 3
207 - _id: 4
208 command_name: insert
209 database_name: *database_name
210
211 outcome:
212 collection:
213 data:
214 - {_id: 1}
215 - {_id: 2}
216 - {_id: 3}
217 - {_id: 4}
View as plain text