1{
2 "description": "runCursorCommand",
3 "schemaVersion": "1.9",
4 "runOnRequirements": [
5 {
6 "minServerVersion": "4.4"
7 }
8 ],
9 "createEntities": [
10 {
11 "client": {
12 "id": "failPointClient",
13 "useMultipleMongoses": false
14 }
15 },
16 {
17 "client": {
18 "id": "commandClient",
19 "useMultipleMongoses": false,
20 "observeEvents": [
21 "commandStartedEvent",
22 "commandSucceededEvent"
23 ]
24 }
25 },
26 {
27 "client": {
28 "id": "client",
29 "useMultipleMongoses": false,
30 "observeEvents": [
31 "commandStartedEvent"
32 ],
33 "ignoreCommandMonitoringEvents": [
34 "killCursors"
35 ]
36 }
37 },
38 {
39 "database": {
40 "id": "commandDb",
41 "client": "commandClient",
42 "databaseName": "commandDb"
43 }
44 },
45 {
46 "database": {
47 "id": "db",
48 "client": "client",
49 "databaseName": "db"
50 }
51 },
52 {
53 "collection": {
54 "id": "collection",
55 "database": "db",
56 "collectionName": "collection"
57 }
58 }
59 ],
60 "initialData": [
61 {
62 "collectionName": "collection",
63 "databaseName": "db",
64 "documents": [
65 {
66 "_id": 1,
67 "x": 11
68 },
69 {
70 "_id": 2,
71 "x": 22
72 },
73 {
74 "_id": 3,
75 "x": 33
76 },
77 {
78 "_id": 4,
79 "x": 44
80 },
81 {
82 "_id": 5,
83 "x": 55
84 }
85 ]
86 }
87 ],
88 "tests": [
89 {
90 "description": "errors if timeoutMode is set without timeoutMS",
91 "operations": [
92 {
93 "name": "runCursorCommand",
94 "object": "db",
95 "arguments": {
96 "commandName": "find",
97 "command": {
98 "find": "collection"
99 },
100 "timeoutMode": "cursorLifetime"
101 },
102 "expectError": {
103 "isClientError": true
104 }
105 }
106 ]
107 },
108 {
109 "description": "error if timeoutMode is cursorLifetime and cursorType is tailableAwait",
110 "operations": [
111 {
112 "name": "runCursorCommand",
113 "object": "db",
114 "arguments": {
115 "commandName": "find",
116 "command": {
117 "find": "collection"
118 },
119 "timeoutMode": "cursorLifetime",
120 "cursorType": "tailableAwait"
121 },
122 "expectError": {
123 "isClientError": true
124 }
125 }
126 ]
127 },
128 {
129 "description": "Non-tailable cursor lifetime remaining timeoutMS applied to getMore if timeoutMode is unset",
130 "runOnRequirements": [
131 {
132 "serverless": "forbid"
133 }
134 ],
135 "operations": [
136 {
137 "name": "failPoint",
138 "object": "testRunner",
139 "arguments": {
140 "client": "failPointClient",
141 "failPoint": {
142 "configureFailPoint": "failCommand",
143 "mode": {
144 "times": 2
145 },
146 "data": {
147 "failCommands": [
148 "find",
149 "getMore"
150 ],
151 "blockConnection": true,
152 "blockTimeMS": 60
153 }
154 }
155 }
156 },
157 {
158 "name": "runCursorCommand",
159 "object": "db",
160 "arguments": {
161 "commandName": "find",
162 "timeoutMS": 100,
163 "command": {
164 "find": "collection",
165 "batchSize": 2
166 }
167 },
168 "expectError": {
169 "isTimeoutError": true
170 }
171 }
172 ],
173 "expectEvents": [
174 {
175 "client": "client",
176 "events": [
177 {
178 "commandStartedEvent": {
179 "commandName": "find",
180 "command": {
181 "find": "collection",
182 "maxTimeMS": {
183 "$$type": [
184 "int",
185 "long"
186 ]
187 }
188 }
189 }
190 },
191 {
192 "commandStartedEvent": {
193 "commandName": "getMore",
194 "command": {
195 "getMore": {
196 "$$type": [
197 "int",
198 "long"
199 ]
200 },
201 "collection": "collection",
202 "maxTimeMS": {
203 "$$exists": true
204 }
205 }
206 }
207 }
208 ]
209 }
210 ]
211 },
212 {
213 "description": "Non=tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure",
214 "runOnRequirements": [
215 {
216 "serverless": "forbid"
217 }
218 ],
219 "operations": [
220 {
221 "name": "failPoint",
222 "object": "testRunner",
223 "arguments": {
224 "client": "failPointClient",
225 "failPoint": {
226 "configureFailPoint": "failCommand",
227 "mode": {
228 "times": 1
229 },
230 "data": {
231 "failCommands": [
232 "getMore"
233 ],
234 "blockConnection": true,
235 "blockTimeMS": 60
236 }
237 }
238 }
239 },
240 {
241 "name": "runCursorCommand",
242 "object": "db",
243 "arguments": {
244 "commandName": "find",
245 "command": {
246 "find": "collection",
247 "batchSize": 2
248 },
249 "timeoutMode": "iteration",
250 "timeoutMS": 100,
251 "batchSize": 2
252 },
253 "expectError": {
254 "isTimeoutError": true
255 }
256 }
257 ],
258 "expectEvents": [
259 {
260 "client": "client",
261 "events": [
262 {
263 "commandStartedEvent": {
264 "commandName": "find",
265 "databaseName": "db",
266 "command": {
267 "find": "collection",
268 "maxTimeMS": {
269 "$$exists": false
270 }
271 }
272 }
273 },
274 {
275 "commandStartedEvent": {
276 "commandName": "getMore",
277 "databaseName": "db",
278 "command": {
279 "getMore": {
280 "$$type": [
281 "int",
282 "long"
283 ]
284 },
285 "collection": "collection",
286 "maxTimeMS": {
287 "$$exists": false
288 }
289 }
290 }
291 }
292 ]
293 }
294 ]
295 },
296 {
297 "description": "Tailable cursor iteration timeoutMS is refreshed for getMore - failure",
298 "runOnRequirements": [
299 {
300 "serverless": "forbid"
301 }
302 ],
303 "operations": [
304 {
305 "name": "failPoint",
306 "object": "testRunner",
307 "arguments": {
308 "client": "failPointClient",
309 "failPoint": {
310 "configureFailPoint": "failCommand",
311 "mode": {
312 "times": 1
313 },
314 "data": {
315 "failCommands": [
316 "getMore"
317 ],
318 "blockConnection": true,
319 "blockTimeMS": 60
320 }
321 }
322 }
323 },
324 {
325 "name": "dropCollection",
326 "object": "db",
327 "arguments": {
328 "collection": "cappedCollection"
329 }
330 },
331 {
332 "name": "createCollection",
333 "object": "db",
334 "arguments": {
335 "collection": "cappedCollection",
336 "capped": true,
337 "size": 4096,
338 "max": 3
339 },
340 "saveResultAsEntity": "cappedCollection"
341 },
342 {
343 "name": "insertMany",
344 "object": "cappedCollection",
345 "arguments": {
346 "documents": [
347 {
348 "_id": 1,
349 "x": 11
350 },
351 {
352 "_id": 2,
353 "x": 22
354 }
355 ]
356 }
357 },
358 {
359 "name": "createCommandCursor",
360 "object": "db",
361 "arguments": {
362 "commandName": "find",
363 "command": {
364 "find": "cappedCollection",
365 "batchSize": 1,
366 "tailable": true
367 },
368 "timeoutMode": "iteration",
369 "timeoutMS": 100,
370 "batchSize": 1,
371 "cursorType": "tailable"
372 },
373 "saveResultAsEntity": "tailableCursor"
374 },
375 {
376 "name": "iterateUntilDocumentOrError",
377 "object": "tailableCursor"
378 },
379 {
380 "name": "iterateUntilDocumentOrError",
381 "object": "tailableCursor",
382 "expectError": {
383 "isTimeoutError": true
384 }
385 }
386 ],
387 "expectEvents": [
388 {
389 "client": "client",
390 "events": [
391 {
392 "commandStartedEvent": {
393 "commandName": "drop"
394 }
395 },
396 {
397 "commandStartedEvent": {
398 "commandName": "create"
399 }
400 },
401 {
402 "commandStartedEvent": {
403 "commandName": "insert"
404 }
405 },
406 {
407 "commandStartedEvent": {
408 "commandName": "find",
409 "databaseName": "db",
410 "command": {
411 "find": "cappedCollection",
412 "tailable": true,
413 "awaitData": {
414 "$$exists": false
415 },
416 "maxTimeMS": {
417 "$$exists": false
418 }
419 }
420 }
421 },
422 {
423 "commandStartedEvent": {
424 "commandName": "getMore",
425 "databaseName": "db",
426 "command": {
427 "getMore": {
428 "$$type": [
429 "int",
430 "long"
431 ]
432 },
433 "collection": "cappedCollection",
434 "maxTimeMS": {
435 "$$exists": false
436 }
437 }
438 }
439 }
440 ]
441 }
442 ]
443 },
444 {
445 "description": "Tailable cursor awaitData iteration timeoutMS is refreshed for getMore - failure",
446 "runOnRequirements": [
447 {
448 "serverless": "forbid"
449 }
450 ],
451 "operations": [
452 {
453 "name": "failPoint",
454 "object": "testRunner",
455 "arguments": {
456 "client": "failPointClient",
457 "failPoint": {
458 "configureFailPoint": "failCommand",
459 "mode": {
460 "times": 1
461 },
462 "data": {
463 "failCommands": [
464 "getMore"
465 ],
466 "blockConnection": true,
467 "blockTimeMS": 60
468 }
469 }
470 }
471 },
472 {
473 "name": "dropCollection",
474 "object": "db",
475 "arguments": {
476 "collection": "cappedCollection"
477 }
478 },
479 {
480 "name": "createCollection",
481 "object": "db",
482 "arguments": {
483 "collection": "cappedCollection",
484 "capped": true,
485 "size": 4096,
486 "max": 3
487 },
488 "saveResultAsEntity": "cappedCollection"
489 },
490 {
491 "name": "insertMany",
492 "object": "cappedCollection",
493 "arguments": {
494 "documents": [
495 {
496 "foo": "bar"
497 },
498 {
499 "fizz": "buzz"
500 }
501 ]
502 }
503 },
504 {
505 "name": "createCommandCursor",
506 "object": "db",
507 "arguments": {
508 "command": {
509 "find": "cappedCollection",
510 "tailable": true,
511 "awaitData": true
512 },
513 "cursorType": "tailableAwait",
514 "batchSize": 1
515 },
516 "saveResultAsEntity": "tailableCursor"
517 },
518 {
519 "name": "iterateUntilDocumentOrError",
520 "object": "tailableCursor"
521 },
522 {
523 "name": "iterateUntilDocumentOrError",
524 "object": "tailableCursor",
525 "expectError": {
526 "isTimeoutError": true
527 }
528 }
529 ],
530 "expectEvents": [
531 {
532 "client": "client",
533 "events": [
534 {
535 "commandStartedEvent": {
536 "commandName": "drop"
537 }
538 },
539 {
540 "commandStartedEvent": {
541 "commandName": "create"
542 }
543 },
544 {
545 "commandStartedEvent": {
546 "commandName": "insert"
547 }
548 },
549 {
550 "commandStartedEvent": {
551 "commandName": "find",
552 "databaseName": "db",
553 "command": {
554 "find": "cappedCollection",
555 "tailable": true,
556 "awaitData": true,
557 "maxTimeMS": {
558 "$$exists": true
559 }
560 }
561 }
562 },
563 {
564 "commandStartedEvent": {
565 "commandName": "getMore",
566 "databaseName": "db",
567 "command": {
568 "getMore": {
569 "$$type": [
570 "int",
571 "long"
572 ]
573 },
574 "collection": "cappedCollection"
575 }
576 }
577 }
578 ]
579 }
580 ]
581 }
582 ]
583}
View as plain text