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  "tests": [
30    {
31      "description": "EstimatedDocumentCount succeeds after InterruptedAtShutdown",
32      "failPoint": {
33        "configureFailPoint": "failCommand",
34        "mode": {
35          "times": 1
36        },
37        "data": {
38          "failCommands": [
39            "count"
40          ],
41          "errorCode": 11600
42        }
43      },
44      "operations": [
45        {
46          "name": "estimatedDocumentCount",
47          "object": "collection",
48          "result": 2
49        }
50      ],
51      "expectations": [
52        {
53          "command_started_event": {
54            "command": {
55              "count": "coll"
56            },
57            "database_name": "retryable-reads-tests"
58          }
59        },
60        {
61          "command_started_event": {
62            "command": {
63              "count": "coll"
64            },
65            "database_name": "retryable-reads-tests"
66          }
67        }
68      ]
69    },
70    {
71      "description": "EstimatedDocumentCount succeeds after InterruptedDueToReplStateChange",
72      "failPoint": {
73        "configureFailPoint": "failCommand",
74        "mode": {
75          "times": 1
76        },
77        "data": {
78          "failCommands": [
79            "count"
80          ],
81          "errorCode": 11602
82        }
83      },
84      "operations": [
85        {
86          "name": "estimatedDocumentCount",
87          "object": "collection",
88          "result": 2
89        }
90      ],
91      "expectations": [
92        {
93          "command_started_event": {
94            "command": {
95              "count": "coll"
96            },
97            "database_name": "retryable-reads-tests"
98          }
99        },
100        {
101          "command_started_event": {
102            "command": {
103              "count": "coll"
104            },
105            "database_name": "retryable-reads-tests"
106          }
107        }
108      ]
109    },
110    {
111      "description": "EstimatedDocumentCount succeeds after NotMaster",
112      "failPoint": {
113        "configureFailPoint": "failCommand",
114        "mode": {
115          "times": 1
116        },
117        "data": {
118          "failCommands": [
119            "count"
120          ],
121          "errorCode": 10107
122        }
123      },
124      "operations": [
125        {
126          "name": "estimatedDocumentCount",
127          "object": "collection",
128          "result": 2
129        }
130      ],
131      "expectations": [
132        {
133          "command_started_event": {
134            "command": {
135              "count": "coll"
136            },
137            "database_name": "retryable-reads-tests"
138          }
139        },
140        {
141          "command_started_event": {
142            "command": {
143              "count": "coll"
144            },
145            "database_name": "retryable-reads-tests"
146          }
147        }
148      ]
149    },
150    {
151      "description": "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk",
152      "failPoint": {
153        "configureFailPoint": "failCommand",
154        "mode": {
155          "times": 1
156        },
157        "data": {
158          "failCommands": [
159            "count"
160          ],
161          "errorCode": 13435
162        }
163      },
164      "operations": [
165        {
166          "name": "estimatedDocumentCount",
167          "object": "collection",
168          "result": 2
169        }
170      ],
171      "expectations": [
172        {
173          "command_started_event": {
174            "command": {
175              "count": "coll"
176            },
177            "database_name": "retryable-reads-tests"
178          }
179        },
180        {
181          "command_started_event": {
182            "command": {
183              "count": "coll"
184            },
185            "database_name": "retryable-reads-tests"
186          }
187        }
188      ]
189    },
190    {
191      "description": "EstimatedDocumentCount succeeds after NotMasterOrSecondary",
192      "failPoint": {
193        "configureFailPoint": "failCommand",
194        "mode": {
195          "times": 1
196        },
197        "data": {
198          "failCommands": [
199            "count"
200          ],
201          "errorCode": 13436
202        }
203      },
204      "operations": [
205        {
206          "name": "estimatedDocumentCount",
207          "object": "collection",
208          "result": 2
209        }
210      ],
211      "expectations": [
212        {
213          "command_started_event": {
214            "command": {
215              "count": "coll"
216            },
217            "database_name": "retryable-reads-tests"
218          }
219        },
220        {
221          "command_started_event": {
222            "command": {
223              "count": "coll"
224            },
225            "database_name": "retryable-reads-tests"
226          }
227        }
228      ]
229    },
230    {
231      "description": "EstimatedDocumentCount succeeds after PrimarySteppedDown",
232      "failPoint": {
233        "configureFailPoint": "failCommand",
234        "mode": {
235          "times": 1
236        },
237        "data": {
238          "failCommands": [
239            "count"
240          ],
241          "errorCode": 189
242        }
243      },
244      "operations": [
245        {
246          "name": "estimatedDocumentCount",
247          "object": "collection",
248          "result": 2
249        }
250      ],
251      "expectations": [
252        {
253          "command_started_event": {
254            "command": {
255              "count": "coll"
256            },
257            "database_name": "retryable-reads-tests"
258          }
259        },
260        {
261          "command_started_event": {
262            "command": {
263              "count": "coll"
264            },
265            "database_name": "retryable-reads-tests"
266          }
267        }
268      ]
269    },
270    {
271      "description": "EstimatedDocumentCount succeeds after ShutdownInProgress",
272      "failPoint": {
273        "configureFailPoint": "failCommand",
274        "mode": {
275          "times": 1
276        },
277        "data": {
278          "failCommands": [
279            "count"
280          ],
281          "errorCode": 91
282        }
283      },
284      "operations": [
285        {
286          "name": "estimatedDocumentCount",
287          "object": "collection",
288          "result": 2
289        }
290      ],
291      "expectations": [
292        {
293          "command_started_event": {
294            "command": {
295              "count": "coll"
296            },
297            "database_name": "retryable-reads-tests"
298          }
299        },
300        {
301          "command_started_event": {
302            "command": {
303              "count": "coll"
304            },
305            "database_name": "retryable-reads-tests"
306          }
307        }
308      ]
309    },
310    {
311      "description": "EstimatedDocumentCount succeeds after HostNotFound",
312      "failPoint": {
313        "configureFailPoint": "failCommand",
314        "mode": {
315          "times": 1
316        },
317        "data": {
318          "failCommands": [
319            "count"
320          ],
321          "errorCode": 7
322        }
323      },
324      "operations": [
325        {
326          "name": "estimatedDocumentCount",
327          "object": "collection",
328          "result": 2
329        }
330      ],
331      "expectations": [
332        {
333          "command_started_event": {
334            "command": {
335              "count": "coll"
336            },
337            "database_name": "retryable-reads-tests"
338          }
339        },
340        {
341          "command_started_event": {
342            "command": {
343              "count": "coll"
344            },
345            "database_name": "retryable-reads-tests"
346          }
347        }
348      ]
349    },
350    {
351      "description": "EstimatedDocumentCount succeeds after HostUnreachable",
352      "failPoint": {
353        "configureFailPoint": "failCommand",
354        "mode": {
355          "times": 1
356        },
357        "data": {
358          "failCommands": [
359            "count"
360          ],
361          "errorCode": 6
362        }
363      },
364      "operations": [
365        {
366          "name": "estimatedDocumentCount",
367          "object": "collection",
368          "result": 2
369        }
370      ],
371      "expectations": [
372        {
373          "command_started_event": {
374            "command": {
375              "count": "coll"
376            },
377            "database_name": "retryable-reads-tests"
378          }
379        },
380        {
381          "command_started_event": {
382            "command": {
383              "count": "coll"
384            },
385            "database_name": "retryable-reads-tests"
386          }
387        }
388      ]
389    },
390    {
391      "description": "EstimatedDocumentCount succeeds after NetworkTimeout",
392      "failPoint": {
393        "configureFailPoint": "failCommand",
394        "mode": {
395          "times": 1
396        },
397        "data": {
398          "failCommands": [
399            "count"
400          ],
401          "errorCode": 89
402        }
403      },
404      "operations": [
405        {
406          "name": "estimatedDocumentCount",
407          "object": "collection",
408          "result": 2
409        }
410      ],
411      "expectations": [
412        {
413          "command_started_event": {
414            "command": {
415              "count": "coll"
416            },
417            "database_name": "retryable-reads-tests"
418          }
419        },
420        {
421          "command_started_event": {
422            "command": {
423              "count": "coll"
424            },
425            "database_name": "retryable-reads-tests"
426          }
427        }
428      ]
429    },
430    {
431      "description": "EstimatedDocumentCount succeeds after SocketException",
432      "failPoint": {
433        "configureFailPoint": "failCommand",
434        "mode": {
435          "times": 1
436        },
437        "data": {
438          "failCommands": [
439            "count"
440          ],
441          "errorCode": 9001
442        }
443      },
444      "operations": [
445        {
446          "name": "estimatedDocumentCount",
447          "object": "collection",
448          "result": 2
449        }
450      ],
451      "expectations": [
452        {
453          "command_started_event": {
454            "command": {
455              "count": "coll"
456            },
457            "database_name": "retryable-reads-tests"
458          }
459        },
460        {
461          "command_started_event": {
462            "command": {
463              "count": "coll"
464            },
465            "database_name": "retryable-reads-tests"
466          }
467        }
468      ]
469    },
470    {
471      "description": "EstimatedDocumentCount fails after two NotMaster errors",
472      "failPoint": {
473        "configureFailPoint": "failCommand",
474        "mode": {
475          "times": 2
476        },
477        "data": {
478          "failCommands": [
479            "count"
480          ],
481          "errorCode": 10107
482        }
483      },
484      "operations": [
485        {
486          "name": "estimatedDocumentCount",
487          "object": "collection",
488          "error": true
489        }
490      ],
491      "expectations": [
492        {
493          "command_started_event": {
494            "command": {
495              "count": "coll"
496            },
497            "database_name": "retryable-reads-tests"
498          }
499        },
500        {
501          "command_started_event": {
502            "command": {
503              "count": "coll"
504            },
505            "database_name": "retryable-reads-tests"
506          }
507        }
508      ]
509    },
510    {
511      "description": "EstimatedDocumentCount fails after NotMaster when retryReads is false",
512      "clientOptions": {
513        "retryReads": false
514      },
515      "failPoint": {
516        "configureFailPoint": "failCommand",
517        "mode": {
518          "times": 1
519        },
520        "data": {
521          "failCommands": [
522            "count"
523          ],
524          "errorCode": 10107
525        }
526      },
527      "operations": [
528        {
529          "name": "estimatedDocumentCount",
530          "object": "collection",
531          "error": true
532        }
533      ],
534      "expectations": [
535        {
536          "command_started_event": {
537            "command": {
538              "count": "coll"
539            },
540            "database_name": "retryable-reads-tests"
541          }
542        }
543      ]
544    }
545  ]
546}
547