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": "Count succeeds on first attempt",
32      "operations": [
33        {
34          "name": "count",
35          "object": "collection",
36          "arguments": {
37            "filter": {}
38          },
39          "result": 2
40        }
41      ],
42      "expectations": [
43        {
44          "command_started_event": {
45            "command": {
46              "aggregate": "coll"
47            },
48            "database_name": "retryable-reads-tests"
49          }
50        }
51      ]
52    },
53    {
54      "description": "Count succeeds on second attempt",
55      "failPoint": {
56        "configureFailPoint": "failCommand",
57        "mode": {
58          "times": 1
59        },
60        "data": {
61          "failCommands": [
62            "aggregate"
63          ],
64          "closeConnection": true
65        }
66      },
67      "operations": [
68        {
69          "name": "count",
70          "object": "collection",
71          "arguments": {
72            "filter": {}
73          },
74          "result": 2
75        }
76      ],
77      "expectations": [
78        {
79          "command_started_event": {
80            "command": {
81              "aggregate": "coll"
82            },
83            "database_name": "retryable-reads-tests"
84          }
85        },
86        {
87          "command_started_event": {
88            "command": {
89              "aggregate": "coll"
90            },
91            "database_name": "retryable-reads-tests"
92          }
93        }
94      ]
95    },
96    {
97      "description": "Count fails on first attempt",
98      "clientOptions": {
99        "retryReads": false
100      },
101      "failPoint": {
102        "configureFailPoint": "failCommand",
103        "mode": {
104          "times": 1
105        },
106        "data": {
107          "failCommands": [
108            "aggregate"
109          ],
110          "closeConnection": true
111        }
112      },
113      "operations": [
114        {
115          "name": "count",
116          "object": "collection",
117          "arguments": {
118            "filter": {}
119          },
120          "error": true
121        }
122      ],
123      "expectations": [
124        {
125          "command_started_event": {
126            "command": {
127              "aggregate": "coll"
128            },
129            "database_name": "retryable-reads-tests"
130          }
131        }
132      ]
133    },
134    {
135      "description": "Count fails on second attempt",
136      "failPoint": {
137        "configureFailPoint": "failCommand",
138        "mode": {
139          "times": 2
140        },
141        "data": {
142          "failCommands": [
143            "aggregate"
144          ],
145          "closeConnection": true
146        }
147      },
148      "operations": [
149        {
150          "name": "count",
151          "object": "collection",
152          "arguments": {
153            "filter": {}
154          },
155          "error": true
156        }
157      ],
158      "expectations": [
159        {
160          "command_started_event": {
161            "command": {
162              "aggregate": "coll"
163            },
164            "database_name": "retryable-reads-tests"
165          }
166        },
167        {
168          "command_started_event": {
169            "command": {
170              "aggregate": "coll"
171            },
172            "database_name": "retryable-reads-tests"
173          }
174        }
175      ]
176    }
177  ]
178}
179