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