1{
2  "runOn": [
3    {
4      "minServerVersion": "4.0",
5      "topology": [
6        "single",
7        "replicaset"
8      ]
9    },
10    {
11      "minServerVersion": "4.1.7",
12      "topology": [
13        "sharded"
14      ]
15    }
16  ],
17  "database_name": "retryable-reads-tests",
18  "collection_name": "coll",
19  "data": [
20    {
21      "_id": 1,
22      "x": 11
23    },
24    {
25      "_id": 2,
26      "x": 22
27    },
28    {
29      "_id": 3,
30      "x": 33
31    },
32    {
33      "_id": 4,
34      "x": 44
35    },
36    {
37      "_id": 5,
38      "x": 55
39    }
40  ],
41  "tests": [
42    {
43      "description": "Find succeeds after InterruptedAtShutdown",
44      "failPoint": {
45        "configureFailPoint": "failCommand",
46        "mode": {
47          "times": 1
48        },
49        "data": {
50          "failCommands": [
51            "find"
52          ],
53          "errorCode": 11600
54        }
55      },
56      "operations": [
57        {
58          "name": "find",
59          "object": "collection",
60          "arguments": {
61            "filter": {},
62            "sort": {
63              "_id": 1
64            },
65            "limit": 4
66          },
67          "result": [
68            {
69              "_id": 1,
70              "x": 11
71            },
72            {
73              "_id": 2,
74              "x": 22
75            },
76            {
77              "_id": 3,
78              "x": 33
79            },
80            {
81              "_id": 4,
82              "x": 44
83            }
84          ]
85        }
86      ],
87      "expectations": [
88        {
89          "command_started_event": {
90            "command": {
91              "find": "coll",
92              "filter": {},
93              "sort": {
94                "_id": 1
95              },
96              "limit": 4
97            },
98            "database_name": "retryable-reads-tests"
99          }
100        },
101        {
102          "command_started_event": {
103            "command": {
104              "find": "coll",
105              "filter": {},
106              "sort": {
107                "_id": 1
108              },
109              "limit": 4
110            },
111            "database_name": "retryable-reads-tests"
112          }
113        }
114      ]
115    },
116    {
117      "description": "Find succeeds after InterruptedDueToReplStateChange",
118      "failPoint": {
119        "configureFailPoint": "failCommand",
120        "mode": {
121          "times": 1
122        },
123        "data": {
124          "failCommands": [
125            "find"
126          ],
127          "errorCode": 11602
128        }
129      },
130      "operations": [
131        {
132          "name": "find",
133          "object": "collection",
134          "arguments": {
135            "filter": {},
136            "sort": {
137              "_id": 1
138            },
139            "limit": 4
140          },
141          "result": [
142            {
143              "_id": 1,
144              "x": 11
145            },
146            {
147              "_id": 2,
148              "x": 22
149            },
150            {
151              "_id": 3,
152              "x": 33
153            },
154            {
155              "_id": 4,
156              "x": 44
157            }
158          ]
159        }
160      ],
161      "expectations": [
162        {
163          "command_started_event": {
164            "command": {
165              "find": "coll",
166              "filter": {},
167              "sort": {
168                "_id": 1
169              },
170              "limit": 4
171            },
172            "database_name": "retryable-reads-tests"
173          }
174        },
175        {
176          "command_started_event": {
177            "command": {
178              "find": "coll",
179              "filter": {},
180              "sort": {
181                "_id": 1
182              },
183              "limit": 4
184            },
185            "database_name": "retryable-reads-tests"
186          }
187        }
188      ]
189    },
190    {
191      "description": "Find succeeds after NotMaster",
192      "failPoint": {
193        "configureFailPoint": "failCommand",
194        "mode": {
195          "times": 1
196        },
197        "data": {
198          "failCommands": [
199            "find"
200          ],
201          "errorCode": 10107
202        }
203      },
204      "operations": [
205        {
206          "name": "find",
207          "object": "collection",
208          "arguments": {
209            "filter": {},
210            "sort": {
211              "_id": 1
212            },
213            "limit": 4
214          },
215          "result": [
216            {
217              "_id": 1,
218              "x": 11
219            },
220            {
221              "_id": 2,
222              "x": 22
223            },
224            {
225              "_id": 3,
226              "x": 33
227            },
228            {
229              "_id": 4,
230              "x": 44
231            }
232          ]
233        }
234      ],
235      "expectations": [
236        {
237          "command_started_event": {
238            "command": {
239              "find": "coll",
240              "filter": {},
241              "sort": {
242                "_id": 1
243              },
244              "limit": 4
245            },
246            "database_name": "retryable-reads-tests"
247          }
248        },
249        {
250          "command_started_event": {
251            "command": {
252              "find": "coll",
253              "filter": {},
254              "sort": {
255                "_id": 1
256              },
257              "limit": 4
258            },
259            "database_name": "retryable-reads-tests"
260          }
261        }
262      ]
263    },
264    {
265      "description": "Find succeeds after NotMasterNoSlaveOk",
266      "failPoint": {
267        "configureFailPoint": "failCommand",
268        "mode": {
269          "times": 1
270        },
271        "data": {
272          "failCommands": [
273            "find"
274          ],
275          "errorCode": 13435
276        }
277      },
278      "operations": [
279        {
280          "name": "find",
281          "object": "collection",
282          "arguments": {
283            "filter": {},
284            "sort": {
285              "_id": 1
286            },
287            "limit": 4
288          },
289          "result": [
290            {
291              "_id": 1,
292              "x": 11
293            },
294            {
295              "_id": 2,
296              "x": 22
297            },
298            {
299              "_id": 3,
300              "x": 33
301            },
302            {
303              "_id": 4,
304              "x": 44
305            }
306          ]
307        }
308      ],
309      "expectations": [
310        {
311          "command_started_event": {
312            "command": {
313              "find": "coll",
314              "filter": {},
315              "sort": {
316                "_id": 1
317              },
318              "limit": 4
319            },
320            "database_name": "retryable-reads-tests"
321          }
322        },
323        {
324          "command_started_event": {
325            "command": {
326              "find": "coll",
327              "filter": {},
328              "sort": {
329                "_id": 1
330              },
331              "limit": 4
332            },
333            "database_name": "retryable-reads-tests"
334          }
335        }
336      ]
337    },
338    {
339      "description": "Find succeeds after NotMasterOrSecondary",
340      "failPoint": {
341        "configureFailPoint": "failCommand",
342        "mode": {
343          "times": 1
344        },
345        "data": {
346          "failCommands": [
347            "find"
348          ],
349          "errorCode": 13436
350        }
351      },
352      "operations": [
353        {
354          "name": "find",
355          "object": "collection",
356          "arguments": {
357            "filter": {},
358            "sort": {
359              "_id": 1
360            },
361            "limit": 4
362          },
363          "result": [
364            {
365              "_id": 1,
366              "x": 11
367            },
368            {
369              "_id": 2,
370              "x": 22
371            },
372            {
373              "_id": 3,
374              "x": 33
375            },
376            {
377              "_id": 4,
378              "x": 44
379            }
380          ]
381        }
382      ],
383      "expectations": [
384        {
385          "command_started_event": {
386            "command": {
387              "find": "coll",
388              "filter": {},
389              "sort": {
390                "_id": 1
391              },
392              "limit": 4
393            },
394            "database_name": "retryable-reads-tests"
395          }
396        },
397        {
398          "command_started_event": {
399            "command": {
400              "find": "coll",
401              "filter": {},
402              "sort": {
403                "_id": 1
404              },
405              "limit": 4
406            },
407            "database_name": "retryable-reads-tests"
408          }
409        }
410      ]
411    },
412    {
413      "description": "Find succeeds after PrimarySteppedDown",
414      "failPoint": {
415        "configureFailPoint": "failCommand",
416        "mode": {
417          "times": 1
418        },
419        "data": {
420          "failCommands": [
421            "find"
422          ],
423          "errorCode": 189
424        }
425      },
426      "operations": [
427        {
428          "name": "find",
429          "object": "collection",
430          "arguments": {
431            "filter": {},
432            "sort": {
433              "_id": 1
434            },
435            "limit": 4
436          },
437          "result": [
438            {
439              "_id": 1,
440              "x": 11
441            },
442            {
443              "_id": 2,
444              "x": 22
445            },
446            {
447              "_id": 3,
448              "x": 33
449            },
450            {
451              "_id": 4,
452              "x": 44
453            }
454          ]
455        }
456      ],
457      "expectations": [
458        {
459          "command_started_event": {
460            "command": {
461              "find": "coll",
462              "filter": {},
463              "sort": {
464                "_id": 1
465              },
466              "limit": 4
467            },
468            "database_name": "retryable-reads-tests"
469          }
470        },
471        {
472          "command_started_event": {
473            "command": {
474              "find": "coll",
475              "filter": {},
476              "sort": {
477                "_id": 1
478              },
479              "limit": 4
480            },
481            "database_name": "retryable-reads-tests"
482          }
483        }
484      ]
485    },
486    {
487      "description": "Find succeeds after ShutdownInProgress",
488      "failPoint": {
489        "configureFailPoint": "failCommand",
490        "mode": {
491          "times": 1
492        },
493        "data": {
494          "failCommands": [
495            "find"
496          ],
497          "errorCode": 91
498        }
499      },
500      "operations": [
501        {
502          "name": "find",
503          "object": "collection",
504          "arguments": {
505            "filter": {},
506            "sort": {
507              "_id": 1
508            },
509            "limit": 4
510          },
511          "result": [
512            {
513              "_id": 1,
514              "x": 11
515            },
516            {
517              "_id": 2,
518              "x": 22
519            },
520            {
521              "_id": 3,
522              "x": 33
523            },
524            {
525              "_id": 4,
526              "x": 44
527            }
528          ]
529        }
530      ],
531      "expectations": [
532        {
533          "command_started_event": {
534            "command": {
535              "find": "coll",
536              "filter": {},
537              "sort": {
538                "_id": 1
539              },
540              "limit": 4
541            },
542            "database_name": "retryable-reads-tests"
543          }
544        },
545        {
546          "command_started_event": {
547            "command": {
548              "find": "coll",
549              "filter": {},
550              "sort": {
551                "_id": 1
552              },
553              "limit": 4
554            },
555            "database_name": "retryable-reads-tests"
556          }
557        }
558      ]
559    },
560    {
561      "description": "Find succeeds after HostNotFound",
562      "failPoint": {
563        "configureFailPoint": "failCommand",
564        "mode": {
565          "times": 1
566        },
567        "data": {
568          "failCommands": [
569            "find"
570          ],
571          "errorCode": 7
572        }
573      },
574      "operations": [
575        {
576          "name": "find",
577          "object": "collection",
578          "arguments": {
579            "filter": {},
580            "sort": {
581              "_id": 1
582            },
583            "limit": 4
584          },
585          "result": [
586            {
587              "_id": 1,
588              "x": 11
589            },
590            {
591              "_id": 2,
592              "x": 22
593            },
594            {
595              "_id": 3,
596              "x": 33
597            },
598            {
599              "_id": 4,
600              "x": 44
601            }
602          ]
603        }
604      ],
605      "expectations": [
606        {
607          "command_started_event": {
608            "command": {
609              "find": "coll",
610              "filter": {},
611              "sort": {
612                "_id": 1
613              },
614              "limit": 4
615            },
616            "database_name": "retryable-reads-tests"
617          }
618        },
619        {
620          "command_started_event": {
621            "command": {
622              "find": "coll",
623              "filter": {},
624              "sort": {
625                "_id": 1
626              },
627              "limit": 4
628            },
629            "database_name": "retryable-reads-tests"
630          }
631        }
632      ]
633    },
634    {
635      "description": "Find succeeds after HostUnreachable",
636      "failPoint": {
637        "configureFailPoint": "failCommand",
638        "mode": {
639          "times": 1
640        },
641        "data": {
642          "failCommands": [
643            "find"
644          ],
645          "errorCode": 6
646        }
647      },
648      "operations": [
649        {
650          "name": "find",
651          "object": "collection",
652          "arguments": {
653            "filter": {},
654            "sort": {
655              "_id": 1
656            },
657            "limit": 4
658          },
659          "result": [
660            {
661              "_id": 1,
662              "x": 11
663            },
664            {
665              "_id": 2,
666              "x": 22
667            },
668            {
669              "_id": 3,
670              "x": 33
671            },
672            {
673              "_id": 4,
674              "x": 44
675            }
676          ]
677        }
678      ],
679      "expectations": [
680        {
681          "command_started_event": {
682            "command": {
683              "find": "coll",
684              "filter": {},
685              "sort": {
686                "_id": 1
687              },
688              "limit": 4
689            },
690            "database_name": "retryable-reads-tests"
691          }
692        },
693        {
694          "command_started_event": {
695            "command": {
696              "find": "coll",
697              "filter": {},
698              "sort": {
699                "_id": 1
700              },
701              "limit": 4
702            },
703            "database_name": "retryable-reads-tests"
704          }
705        }
706      ]
707    },
708    {
709      "description": "Find succeeds after NetworkTimeout",
710      "failPoint": {
711        "configureFailPoint": "failCommand",
712        "mode": {
713          "times": 1
714        },
715        "data": {
716          "failCommands": [
717            "find"
718          ],
719          "errorCode": 89
720        }
721      },
722      "operations": [
723        {
724          "name": "find",
725          "object": "collection",
726          "arguments": {
727            "filter": {},
728            "sort": {
729              "_id": 1
730            },
731            "limit": 4
732          },
733          "result": [
734            {
735              "_id": 1,
736              "x": 11
737            },
738            {
739              "_id": 2,
740              "x": 22
741            },
742            {
743              "_id": 3,
744              "x": 33
745            },
746            {
747              "_id": 4,
748              "x": 44
749            }
750          ]
751        }
752      ],
753      "expectations": [
754        {
755          "command_started_event": {
756            "command": {
757              "find": "coll",
758              "filter": {},
759              "sort": {
760                "_id": 1
761              },
762              "limit": 4
763            },
764            "database_name": "retryable-reads-tests"
765          }
766        },
767        {
768          "command_started_event": {
769            "command": {
770              "find": "coll",
771              "filter": {},
772              "sort": {
773                "_id": 1
774              },
775              "limit": 4
776            },
777            "database_name": "retryable-reads-tests"
778          }
779        }
780      ]
781    },
782    {
783      "description": "Find succeeds after SocketException",
784      "failPoint": {
785        "configureFailPoint": "failCommand",
786        "mode": {
787          "times": 1
788        },
789        "data": {
790          "failCommands": [
791            "find"
792          ],
793          "errorCode": 9001
794        }
795      },
796      "operations": [
797        {
798          "name": "find",
799          "object": "collection",
800          "arguments": {
801            "filter": {},
802            "sort": {
803              "_id": 1
804            },
805            "limit": 4
806          },
807          "result": [
808            {
809              "_id": 1,
810              "x": 11
811            },
812            {
813              "_id": 2,
814              "x": 22
815            },
816            {
817              "_id": 3,
818              "x": 33
819            },
820            {
821              "_id": 4,
822              "x": 44
823            }
824          ]
825        }
826      ],
827      "expectations": [
828        {
829          "command_started_event": {
830            "command": {
831              "find": "coll",
832              "filter": {},
833              "sort": {
834                "_id": 1
835              },
836              "limit": 4
837            },
838            "database_name": "retryable-reads-tests"
839          }
840        },
841        {
842          "command_started_event": {
843            "command": {
844              "find": "coll",
845              "filter": {},
846              "sort": {
847                "_id": 1
848              },
849              "limit": 4
850            },
851            "database_name": "retryable-reads-tests"
852          }
853        }
854      ]
855    },
856    {
857      "description": "Find fails after two NotMaster errors",
858      "failPoint": {
859        "configureFailPoint": "failCommand",
860        "mode": {
861          "times": 2
862        },
863        "data": {
864          "failCommands": [
865            "find"
866          ],
867          "errorCode": 10107
868        }
869      },
870      "operations": [
871        {
872          "name": "find",
873          "object": "collection",
874          "arguments": {
875            "filter": {},
876            "sort": {
877              "_id": 1
878            },
879            "limit": 4
880          },
881          "error": true
882        }
883      ],
884      "expectations": [
885        {
886          "command_started_event": {
887            "command": {
888              "find": "coll",
889              "filter": {},
890              "sort": {
891                "_id": 1
892              },
893              "limit": 4
894            },
895            "database_name": "retryable-reads-tests"
896          }
897        },
898        {
899          "command_started_event": {
900            "command": {
901              "find": "coll",
902              "filter": {},
903              "sort": {
904                "_id": 1
905              },
906              "limit": 4
907            },
908            "database_name": "retryable-reads-tests"
909          }
910        }
911      ]
912    },
913    {
914      "description": "Find fails after NotMaster when retryReads is false",
915      "clientOptions": {
916        "retryReads": false
917      },
918      "failPoint": {
919        "configureFailPoint": "failCommand",
920        "mode": {
921          "times": 1
922        },
923        "data": {
924          "failCommands": [
925            "find"
926          ],
927          "errorCode": 10107
928        }
929      },
930      "operations": [
931        {
932          "name": "find",
933          "object": "collection",
934          "arguments": {
935            "filter": {},
936            "sort": {
937              "_id": 1
938            },
939            "limit": 4
940          },
941          "error": true
942        }
943      ],
944      "expectations": [
945        {
946          "command_started_event": {
947            "command": {
948              "find": "coll",
949              "filter": {},
950              "sort": {
951                "_id": 1
952              },
953              "limit": 4
954            },
955            "database_name": "retryable-reads-tests"
956          }
957        }
958      ]
959    }
960  ]
961}
962