1{
2 "runOn": [
3 {
4 "minServerVersion": "4.0",
5 "topology": [
6 "replicaset"
7 ]
8 },
9 {
10 "minServerVersion": "4.1.8",
11 "topology": [
12 "sharded"
13 ]
14 }
15 ],
16 "database_name": "withTransaction-tests",
17 "collection_name": "test",
18 "data": [],
19 "tests": [
20 {
21 "description": "callback succeeds after multiple connection errors",
22 "failPoint": {
23 "configureFailPoint": "failCommand",
24 "mode": {
25 "times": 2
26 },
27 "data": {
28 "failCommands": [
29 "insert"
30 ],
31 "closeConnection": true
32 }
33 },
34 "operations": [
35 {
36 "name": "withTransaction",
37 "object": "session0",
38 "arguments": {
39 "callback": {
40 "operations": [
41 {
42 "name": "insertOne",
43 "object": "collection",
44 "arguments": {
45 "session": "session0",
46 "document": {
47 "_id": 1
48 }
49 }
50 }
51 ]
52 }
53 }
54 }
55 ],
56 "expectations": [
57 {
58 "command_started_event": {
59 "command": {
60 "insert": "test",
61 "documents": [
62 {
63 "_id": 1
64 }
65 ],
66 "ordered": true,
67 "lsid": "session0",
68 "txnNumber": {
69 "$numberLong": "1"
70 },
71 "startTransaction": true,
72 "autocommit": false,
73 "readConcern": null,
74 "writeConcern": null
75 },
76 "command_name": "insert",
77 "database_name": "withTransaction-tests"
78 }
79 },
80 {
81 "command_started_event": {
82 "command": {
83 "abortTransaction": 1,
84 "lsid": "session0",
85 "txnNumber": {
86 "$numberLong": "1"
87 },
88 "autocommit": false,
89 "readConcern": null,
90 "startTransaction": null,
91 "writeConcern": null
92 },
93 "command_name": "abortTransaction",
94 "database_name": "admin"
95 }
96 },
97 {
98 "command_started_event": {
99 "command": {
100 "insert": "test",
101 "documents": [
102 {
103 "_id": 1
104 }
105 ],
106 "ordered": true,
107 "lsid": "session0",
108 "readConcern": {
109 "afterClusterTime": 42
110 },
111 "txnNumber": {
112 "$numberLong": "2"
113 },
114 "startTransaction": true,
115 "autocommit": false,
116 "writeConcern": null
117 },
118 "command_name": "insert",
119 "database_name": "withTransaction-tests"
120 }
121 },
122 {
123 "command_started_event": {
124 "command": {
125 "abortTransaction": 1,
126 "lsid": "session0",
127 "txnNumber": {
128 "$numberLong": "2"
129 },
130 "autocommit": false,
131 "readConcern": null,
132 "startTransaction": null,
133 "writeConcern": null
134 },
135 "command_name": "abortTransaction",
136 "database_name": "admin"
137 }
138 },
139 {
140 "command_started_event": {
141 "command": {
142 "insert": "test",
143 "documents": [
144 {
145 "_id": 1
146 }
147 ],
148 "ordered": true,
149 "lsid": "session0",
150 "readConcern": {
151 "afterClusterTime": 42
152 },
153 "txnNumber": {
154 "$numberLong": "3"
155 },
156 "startTransaction": true,
157 "autocommit": false,
158 "writeConcern": null
159 },
160 "command_name": "insert",
161 "database_name": "withTransaction-tests"
162 }
163 },
164 {
165 "command_started_event": {
166 "command": {
167 "commitTransaction": 1,
168 "lsid": "session0",
169 "txnNumber": {
170 "$numberLong": "3"
171 },
172 "autocommit": false,
173 "readConcern": null,
174 "startTransaction": null,
175 "writeConcern": null
176 },
177 "command_name": "commitTransaction",
178 "database_name": "admin"
179 }
180 }
181 ],
182 "outcome": {
183 "collection": {
184 "data": [
185 {
186 "_id": 1
187 }
188 ]
189 }
190 }
191 },
192 {
193 "description": "callback is not retried after non-transient error (DuplicateKeyError)",
194 "useMultipleMongoses": true,
195 "operations": [
196 {
197 "name": "withTransaction",
198 "object": "session0",
199 "arguments": {
200 "callback": {
201 "operations": [
202 {
203 "name": "insertOne",
204 "object": "collection",
205 "arguments": {
206 "session": "session0",
207 "document": {
208 "_id": 1
209 }
210 },
211 "result": {
212 "insertedId": 1
213 }
214 },
215 {
216 "name": "insertOne",
217 "object": "collection",
218 "arguments": {
219 "session": "session0",
220 "document": {
221 "_id": 1
222 }
223 },
224 "result": {
225 "errorLabelsOmit": [
226 "TransientTransactionError",
227 "UnknownTransactionCommitResult"
228 ]
229 }
230 }
231 ]
232 }
233 },
234 "result": {
235 "errorLabelsOmit": [
236 "TransientTransactionError",
237 "UnknownTransactionCommitResult"
238 ],
239 "errorContains": "E11000"
240 }
241 }
242 ],
243 "expectations": [
244 {
245 "command_started_event": {
246 "command": {
247 "insert": "test",
248 "documents": [
249 {
250 "_id": 1
251 }
252 ],
253 "ordered": true,
254 "lsid": "session0",
255 "txnNumber": {
256 "$numberLong": "1"
257 },
258 "startTransaction": true,
259 "autocommit": false,
260 "readConcern": null,
261 "writeConcern": null
262 },
263 "command_name": "insert",
264 "database_name": "withTransaction-tests"
265 }
266 },
267 {
268 "command_started_event": {
269 "command": {
270 "insert": "test",
271 "documents": [
272 {
273 "_id": 1
274 }
275 ],
276 "ordered": true,
277 "lsid": "session0",
278 "txnNumber": {
279 "$numberLong": "1"
280 },
281 "autocommit": false,
282 "readConcern": null,
283 "startTransaction": null,
284 "writeConcern": null
285 },
286 "command_name": "insert",
287 "database_name": "withTransaction-tests"
288 }
289 },
290 {
291 "command_started_event": {
292 "command": {
293 "abortTransaction": 1,
294 "lsid": "session0",
295 "txnNumber": {
296 "$numberLong": "1"
297 },
298 "autocommit": false,
299 "readConcern": null,
300 "startTransaction": null,
301 "writeConcern": null
302 },
303 "command_name": "abortTransaction",
304 "database_name": "admin"
305 }
306 }
307 ],
308 "outcome": {
309 "collection": {
310 "data": []
311 }
312 }
313 }
314 ]
315}
View as plain text