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 on first attempt",
44      "operations": [
45        {
46          "name": "find",
47          "object": "collection",
48          "arguments": {
49            "filter": {},
50            "sort": {
51              "_id": 1
52            },
53            "limit": 4
54          },
55          "result": [
56            {
57              "_id": 1,
58              "x": 11
59            },
60            {
61              "_id": 2,
62              "x": 22
63            },
64            {
65              "_id": 3,
66              "x": 33
67            },
68            {
69              "_id": 4,
70              "x": 44
71            }
72          ]
73        }
74      ],
75      "expectations": [
76        {
77          "command_started_event": {
78            "command": {
79              "find": "coll",
80              "filter": {},
81              "sort": {
82                "_id": 1
83              },
84              "limit": 4
85            },
86            "database_name": "retryable-reads-tests"
87          }
88        }
89      ]
90    },
91    {
92      "description": "Find succeeds on second attempt with explicit clientOptions",
93      "clientOptions": {
94        "retryReads": true
95      },
96      "failPoint": {
97        "configureFailPoint": "failCommand",
98        "mode": {
99          "times": 1
100        },
101        "data": {
102          "failCommands": [
103            "find"
104          ],
105          "closeConnection": true
106        }
107      },
108      "operations": [
109        {
110          "name": "find",
111          "object": "collection",
112          "arguments": {
113            "filter": {},
114            "sort": {
115              "_id": 1
116            },
117            "limit": 4
118          },
119          "result": [
120            {
121              "_id": 1,
122              "x": 11
123            },
124            {
125              "_id": 2,
126              "x": 22
127            },
128            {
129              "_id": 3,
130              "x": 33
131            },
132            {
133              "_id": 4,
134              "x": 44
135            }
136          ]
137        }
138      ],
139      "expectations": [
140        {
141          "command_started_event": {
142            "command": {
143              "find": "coll",
144              "filter": {},
145              "sort": {
146                "_id": 1
147              },
148              "limit": 4
149            },
150            "database_name": "retryable-reads-tests"
151          }
152        },
153        {
154          "command_started_event": {
155            "command": {
156              "find": "coll",
157              "filter": {},
158              "sort": {
159                "_id": 1
160              },
161              "limit": 4
162            },
163            "database_name": "retryable-reads-tests"
164          }
165        }
166      ]
167    },
168    {
169      "description": "Find succeeds on second attempt",
170      "failPoint": {
171        "configureFailPoint": "failCommand",
172        "mode": {
173          "times": 1
174        },
175        "data": {
176          "failCommands": [
177            "find"
178          ],
179          "closeConnection": true
180        }
181      },
182      "operations": [
183        {
184          "name": "find",
185          "object": "collection",
186          "arguments": {
187            "filter": {},
188            "sort": {
189              "_id": 1
190            },
191            "limit": 4
192          },
193          "result": [
194            {
195              "_id": 1,
196              "x": 11
197            },
198            {
199              "_id": 2,
200              "x": 22
201            },
202            {
203              "_id": 3,
204              "x": 33
205            },
206            {
207              "_id": 4,
208              "x": 44
209            }
210          ]
211        }
212      ],
213      "expectations": [
214        {
215          "command_started_event": {
216            "command": {
217              "find": "coll",
218              "filter": {},
219              "sort": {
220                "_id": 1
221              },
222              "limit": 4
223            },
224            "database_name": "retryable-reads-tests"
225          }
226        },
227        {
228          "command_started_event": {
229            "command": {
230              "find": "coll",
231              "filter": {},
232              "sort": {
233                "_id": 1
234              },
235              "limit": 4
236            },
237            "database_name": "retryable-reads-tests"
238          }
239        }
240      ]
241    },
242    {
243      "description": "Find fails on first attempt",
244      "clientOptions": {
245        "retryReads": false
246      },
247      "failPoint": {
248        "configureFailPoint": "failCommand",
249        "mode": {
250          "times": 1
251        },
252        "data": {
253          "failCommands": [
254            "find"
255          ],
256          "closeConnection": true
257        }
258      },
259      "operations": [
260        {
261          "name": "find",
262          "object": "collection",
263          "arguments": {
264            "filter": {},
265            "sort": {
266              "_id": 1
267            },
268            "limit": 4
269          },
270          "error": true
271        }
272      ],
273      "expectations": [
274        {
275          "command_started_event": {
276            "command": {
277              "find": "coll",
278              "filter": {},
279              "sort": {
280                "_id": 1
281              },
282              "limit": 4
283            },
284            "database_name": "retryable-reads-tests"
285          }
286        }
287      ]
288    },
289    {
290      "description": "Find fails on second attempt",
291      "failPoint": {
292        "configureFailPoint": "failCommand",
293        "mode": {
294          "times": 2
295        },
296        "data": {
297          "failCommands": [
298            "find"
299          ],
300          "closeConnection": true
301        }
302      },
303      "operations": [
304        {
305          "name": "find",
306          "object": "collection",
307          "arguments": {
308            "filter": {},
309            "sort": {
310              "_id": 1
311            },
312            "limit": 4
313          },
314          "error": true
315        }
316      ],
317      "expectations": [
318        {
319          "command_started_event": {
320            "command": {
321              "find": "coll",
322              "filter": {},
323              "sort": {
324                "_id": 1
325              },
326              "limit": 4
327            },
328            "database_name": "retryable-reads-tests"
329          }
330        },
331        {
332          "command_started_event": {
333            "command": {
334              "find": "coll",
335              "filter": {},
336              "sort": {
337                "_id": 1
338              },
339              "limit": 4
340            },
341            "database_name": "retryable-reads-tests"
342          }
343        }
344      ]
345    }
346  ]
347}
348