1{
2 "description": "poc-transactions-mongos-pin-auto",
3 "schemaVersion": "1.0",
4 "runOnRequirements": [
5 {
6 "minServerVersion": "4.1.8",
7 "topologies": [
8 "sharded-replicaset"
9 ]
10 }
11 ],
12 "createEntities": [
13 {
14 "client": {
15 "id": "client0",
16 "useMultipleMongoses": true,
17 "observeEvents": [
18 "commandStartedEvent"
19 ]
20 }
21 },
22 {
23 "database": {
24 "id": "database0",
25 "client": "client0",
26 "databaseName": "transaction-tests"
27 }
28 },
29 {
30 "collection": {
31 "id": "collection0",
32 "database": "database0",
33 "collectionName": "test"
34 }
35 },
36 {
37 "session": {
38 "id": "session0",
39 "client": "client0"
40 }
41 }
42 ],
43 "initialData": [
44 {
45 "collectionName": "test",
46 "databaseName": "transaction-tests",
47 "documents": [
48 {
49 "_id": 1
50 },
51 {
52 "_id": 2
53 }
54 ]
55 }
56 ],
57 "tests": [
58 {
59 "description": "remain pinned after non-transient Interrupted error on insertOne",
60 "operations": [
61 {
62 "name": "startTransaction",
63 "object": "session0"
64 },
65 {
66 "name": "insertOne",
67 "object": "collection0",
68 "arguments": {
69 "session": "session0",
70 "document": {
71 "_id": 3
72 }
73 },
74 "expectResult": {
75 "$$unsetOrMatches": {
76 "insertedId": {
77 "$$unsetOrMatches": 3
78 }
79 }
80 }
81 },
82 {
83 "name": "targetedFailPoint",
84 "object": "testRunner",
85 "arguments": {
86 "session": "session0",
87 "failPoint": {
88 "configureFailPoint": "failCommand",
89 "mode": {
90 "times": 1
91 },
92 "data": {
93 "failCommands": [
94 "insert"
95 ],
96 "errorCode": 11601
97 }
98 }
99 }
100 },
101 {
102 "name": "insertOne",
103 "object": "collection0",
104 "arguments": {
105 "session": "session0",
106 "document": {
107 "_id": 4
108 }
109 },
110 "expectError": {
111 "errorLabelsOmit": [
112 "TransientTransactionError",
113 "UnknownTransactionCommitResult"
114 ],
115 "errorCodeName": "Interrupted"
116 }
117 },
118 {
119 "name": "assertSessionPinned",
120 "object": "testRunner",
121 "arguments": {
122 "session": "session0"
123 }
124 },
125 {
126 "name": "commitTransaction",
127 "object": "session0"
128 }
129 ],
130 "expectEvents": [
131 {
132 "client": "client0",
133 "events": [
134 {
135 "commandStartedEvent": {
136 "command": {
137 "insert": "test",
138 "documents": [
139 {
140 "_id": 3
141 }
142 ],
143 "ordered": true,
144 "readConcern": {
145 "$$exists": false
146 },
147 "lsid": {
148 "$$sessionLsid": "session0"
149 },
150 "txnNumber": 1,
151 "startTransaction": true,
152 "autocommit": false,
153 "writeConcern": {
154 "$$exists": false
155 }
156 },
157 "commandName": "insert",
158 "databaseName": "transaction-tests"
159 }
160 },
161 {
162 "commandStartedEvent": {
163 "command": {
164 "insert": "test",
165 "documents": [
166 {
167 "_id": 4
168 }
169 ],
170 "ordered": true,
171 "readConcern": {
172 "$$exists": false
173 },
174 "lsid": {
175 "$$sessionLsid": "session0"
176 },
177 "txnNumber": 1,
178 "startTransaction": {
179 "$$exists": false
180 },
181 "autocommit": false,
182 "writeConcern": {
183 "$$exists": false
184 }
185 },
186 "commandName": "insert",
187 "databaseName": "transaction-tests"
188 }
189 },
190 {
191 "commandStartedEvent": {
192 "command": {
193 "commitTransaction": 1,
194 "lsid": {
195 "$$sessionLsid": "session0"
196 },
197 "txnNumber": 1,
198 "startTransaction": {
199 "$$exists": false
200 },
201 "autocommit": false,
202 "writeConcern": {
203 "$$exists": false
204 },
205 "recoveryToken": {
206 "$$type": "object"
207 }
208 },
209 "commandName": "commitTransaction",
210 "databaseName": "admin"
211 }
212 }
213 ]
214 }
215 ],
216 "outcome": [
217 {
218 "collectionName": "test",
219 "databaseName": "transaction-tests",
220 "documents": [
221 {
222 "_id": 1
223 },
224 {
225 "_id": 2
226 },
227 {
228 "_id": 3
229 }
230 ]
231 }
232 ]
233 },
234 {
235 "description": "unpin after transient error within a transaction",
236 "operations": [
237 {
238 "name": "startTransaction",
239 "object": "session0"
240 },
241 {
242 "name": "insertOne",
243 "object": "collection0",
244 "arguments": {
245 "session": "session0",
246 "document": {
247 "_id": 3
248 }
249 },
250 "expectResult": {
251 "$$unsetOrMatches": {
252 "insertedId": {
253 "$$unsetOrMatches": 3
254 }
255 }
256 }
257 },
258 {
259 "name": "targetedFailPoint",
260 "object": "testRunner",
261 "arguments": {
262 "session": "session0",
263 "failPoint": {
264 "configureFailPoint": "failCommand",
265 "mode": {
266 "times": 1
267 },
268 "data": {
269 "failCommands": [
270 "insert"
271 ],
272 "closeConnection": true
273 }
274 }
275 }
276 },
277 {
278 "name": "insertOne",
279 "object": "collection0",
280 "arguments": {
281 "session": "session0",
282 "document": {
283 "_id": 4
284 }
285 },
286 "expectError": {
287 "errorLabelsContain": [
288 "TransientTransactionError"
289 ],
290 "errorLabelsOmit": [
291 "UnknownTransactionCommitResult"
292 ]
293 }
294 },
295 {
296 "name": "assertSessionUnpinned",
297 "object": "testRunner",
298 "arguments": {
299 "session": "session0"
300 }
301 },
302 {
303 "name": "abortTransaction",
304 "object": "session0"
305 }
306 ],
307 "expectEvents": [
308 {
309 "client": "client0",
310 "events": [
311 {
312 "commandStartedEvent": {
313 "command": {
314 "insert": "test",
315 "documents": [
316 {
317 "_id": 3
318 }
319 ],
320 "ordered": true,
321 "readConcern": {
322 "$$exists": false
323 },
324 "lsid": {
325 "$$sessionLsid": "session0"
326 },
327 "txnNumber": 1,
328 "startTransaction": true,
329 "autocommit": false,
330 "writeConcern": {
331 "$$exists": false
332 }
333 },
334 "commandName": "insert",
335 "databaseName": "transaction-tests"
336 }
337 },
338 {
339 "commandStartedEvent": {
340 "command": {
341 "insert": "test",
342 "documents": [
343 {
344 "_id": 4
345 }
346 ],
347 "ordered": true,
348 "readConcern": {
349 "$$exists": false
350 },
351 "lsid": {
352 "$$sessionLsid": "session0"
353 },
354 "txnNumber": 1,
355 "startTransaction": {
356 "$$exists": false
357 },
358 "autocommit": false,
359 "writeConcern": {
360 "$$exists": false
361 }
362 },
363 "commandName": "insert",
364 "databaseName": "transaction-tests"
365 }
366 },
367 {
368 "commandStartedEvent": {
369 "command": {
370 "abortTransaction": 1,
371 "lsid": {
372 "$$sessionLsid": "session0"
373 },
374 "txnNumber": 1,
375 "startTransaction": {
376 "$$exists": false
377 },
378 "autocommit": false,
379 "writeConcern": {
380 "$$exists": false
381 },
382 "recoveryToken": {
383 "$$type": "object"
384 }
385 },
386 "commandName": "abortTransaction",
387 "databaseName": "admin"
388 }
389 }
390 ]
391 }
392 ],
393 "outcome": [
394 {
395 "collectionName": "test",
396 "databaseName": "transaction-tests",
397 "documents": [
398 {
399 "_id": 1
400 },
401 {
402 "_id": 2
403 }
404 ]
405 }
406 ]
407 }
408 ]
409}
View as plain text