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  "tests": [
34    {
35      "description": "Distinct succeeds on first attempt",
36      "operations": [
37        {
38          "name": "distinct",
39          "object": "collection",
40          "arguments": {
41            "fieldName": "x",
42            "filter": {
43              "_id": {
44                "$gt": 1
45              }
46            }
47          },
48          "result": [
49            22,
50            33
51          ]
52        }
53      ],
54      "expectations": [
55        {
56          "command_started_event": {
57            "command": {
58              "distinct": "coll",
59              "key": "x",
60              "query": {
61                "_id": {
62                  "$gt": 1
63                }
64              }
65            },
66            "database_name": "retryable-reads-tests"
67          }
68        }
69      ]
70    },
71    {
72      "description": "Distinct succeeds on second attempt",
73      "failPoint": {
74        "configureFailPoint": "failCommand",
75        "mode": {
76          "times": 1
77        },
78        "data": {
79          "failCommands": [
80            "distinct"
81          ],
82          "closeConnection": true
83        }
84      },
85      "operations": [
86        {
87          "name": "distinct",
88          "object": "collection",
89          "arguments": {
90            "fieldName": "x",
91            "filter": {
92              "_id": {
93                "$gt": 1
94              }
95            }
96          },
97          "result": [
98            22,
99            33
100          ]
101        }
102      ],
103      "expectations": [
104        {
105          "command_started_event": {
106            "command": {
107              "distinct": "coll",
108              "key": "x",
109              "query": {
110                "_id": {
111                  "$gt": 1
112                }
113              }
114            },
115            "database_name": "retryable-reads-tests"
116          }
117        },
118        {
119          "command_started_event": {
120            "command": {
121              "distinct": "coll",
122              "key": "x",
123              "query": {
124                "_id": {
125                  "$gt": 1
126                }
127              }
128            },
129            "database_name": "retryable-reads-tests"
130          }
131        }
132      ]
133    },
134    {
135      "description": "Distinct fails on first attempt",
136      "clientOptions": {
137        "retryReads": false
138      },
139      "failPoint": {
140        "configureFailPoint": "failCommand",
141        "mode": {
142          "times": 1
143        },
144        "data": {
145          "failCommands": [
146            "distinct"
147          ],
148          "closeConnection": true
149        }
150      },
151      "operations": [
152        {
153          "name": "distinct",
154          "object": "collection",
155          "arguments": {
156            "fieldName": "x",
157            "filter": {
158              "_id": {
159                "$gt": 1
160              }
161            }
162          },
163          "error": true
164        }
165      ],
166      "expectations": [
167        {
168          "command_started_event": {
169            "command": {
170              "distinct": "coll",
171              "key": "x",
172              "query": {
173                "_id": {
174                  "$gt": 1
175                }
176              }
177            },
178            "database_name": "retryable-reads-tests"
179          }
180        }
181      ]
182    },
183    {
184      "description": "Distinct fails on second attempt",
185      "failPoint": {
186        "configureFailPoint": "failCommand",
187        "mode": {
188          "times": 2
189        },
190        "data": {
191          "failCommands": [
192            "distinct"
193          ],
194          "closeConnection": true
195        }
196      },
197      "operations": [
198        {
199          "name": "distinct",
200          "object": "collection",
201          "arguments": {
202            "fieldName": "x",
203            "filter": {
204              "_id": {
205                "$gt": 1
206              }
207            }
208          },
209          "error": true
210        }
211      ],
212      "expectations": [
213        {
214          "command_started_event": {
215            "command": {
216              "distinct": "coll",
217              "key": "x",
218              "query": {
219                "_id": {
220                  "$gt": 1
221                }
222              }
223            },
224            "database_name": "retryable-reads-tests"
225          }
226        },
227        {
228          "command_started_event": {
229            "command": {
230              "distinct": "coll",
231              "key": "x",
232              "query": {
233                "_id": {
234                  "$gt": 1
235                }
236              }
237            },
238            "database_name": "retryable-reads-tests"
239          }
240        }
241      ]
242    }
243  ]
244}
245