1{
2  "runOn": [
3    {
4      "minServerVersion": "4.0",
5      "topology": [
6        "replicaset"
7      ]
8    },
9    {
10      "minServerVersion": "4.1.7",
11      "topology": [
12        "sharded"
13      ]
14    }
15  ],
16  "database_name": "retryable-reads-tests",
17  "collection_name": "coll",
18  "data": [
19    {
20      "_id": 1,
21      "x": 11
22    }
23  ],
24  "tests": [
25    {
26      "description": "db.watch succeeds on first attempt",
27      "operations": [
28        {
29          "name": "watch",
30          "object": "database"
31        }
32      ],
33      "expectations": [
34        {
35          "command_started_event": {
36            "command": {
37              "aggregate": 1,
38              "cursor": {},
39              "pipeline": [
40                {
41                  "$changeStream": {
42                    "fullDocument": "default"
43                  }
44                }
45              ]
46            },
47            "database_name": "retryable-reads-tests"
48          }
49        }
50      ]
51    },
52    {
53      "description": "db.watch succeeds on second attempt",
54      "failPoint": {
55        "configureFailPoint": "failCommand",
56        "mode": {
57          "times": 1
58        },
59        "data": {
60          "failCommands": [
61            "aggregate"
62          ],
63          "closeConnection": true
64        }
65      },
66      "operations": [
67        {
68          "name": "watch",
69          "object": "database"
70        }
71      ],
72      "expectations": [
73        {
74          "command_started_event": {
75            "command": {
76              "aggregate": 1,
77              "cursor": {},
78              "pipeline": [
79                {
80                  "$changeStream": {
81                    "fullDocument": "default"
82                  }
83                }
84              ]
85            },
86            "database_name": "retryable-reads-tests"
87          }
88        },
89        {
90          "command_started_event": {
91            "command": {
92              "aggregate": 1,
93              "cursor": {},
94              "pipeline": [
95                {
96                  "$changeStream": {
97                    "fullDocument": "default"
98                  }
99                }
100              ]
101            },
102            "database_name": "retryable-reads-tests"
103          }
104        }
105      ]
106    },
107    {
108      "description": "db.watch fails on first attempt",
109      "clientOptions": {
110        "retryReads": false
111      },
112      "failPoint": {
113        "configureFailPoint": "failCommand",
114        "mode": {
115          "times": 1
116        },
117        "data": {
118          "failCommands": [
119            "aggregate"
120          ],
121          "closeConnection": true
122        }
123      },
124      "operations": [
125        {
126          "name": "watch",
127          "object": "database",
128          "error": true
129        }
130      ],
131      "expectations": [
132        {
133          "command_started_event": {
134            "command": {
135              "aggregate": 1,
136              "cursor": {},
137              "pipeline": [
138                {
139                  "$changeStream": {
140                    "fullDocument": "default"
141                  }
142                }
143              ]
144            },
145            "database_name": "retryable-reads-tests"
146          }
147        }
148      ]
149    },
150    {
151      "description": "db.watch fails on second attempt",
152      "failPoint": {
153        "configureFailPoint": "failCommand",
154        "mode": {
155          "times": 2
156        },
157        "data": {
158          "failCommands": [
159            "aggregate"
160          ],
161          "closeConnection": true
162        }
163      },
164      "operations": [
165        {
166          "name": "watch",
167          "object": "database",
168          "error": true
169        }
170      ],
171      "expectations": [
172        {
173          "command_started_event": {
174            "command": {
175              "aggregate": 1,
176              "cursor": {},
177              "pipeline": [
178                {
179                  "$changeStream": {
180                    "fullDocument": "default"
181                  }
182                }
183              ]
184            },
185            "database_name": "retryable-reads-tests"
186          }
187        },
188        {
189          "command_started_event": {
190            "command": {
191              "aggregate": 1,
192              "cursor": {},
193              "pipeline": [
194                {
195                  "$changeStream": {
196                    "fullDocument": "default"
197                  }
198                }
199              ]
200            },
201            "database_name": "retryable-reads-tests"
202          }
203        }
204      ]
205    }
206  ]
207}
208