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": "withTransaction and no transaction options set",
22 "useMultipleMongoses": true,
23 "operations": [
24 {
25 "name": "withTransaction",
26 "object": "session0",
27 "arguments": {
28 "callback": {
29 "operations": [
30 {
31 "name": "insertOne",
32 "object": "collection",
33 "arguments": {
34 "session": "session0",
35 "document": {
36 "_id": 1
37 }
38 },
39 "result": {
40 "insertedId": 1
41 }
42 }
43 ]
44 }
45 }
46 }
47 ],
48 "expectations": [
49 {
50 "command_started_event": {
51 "command": {
52 "insert": "test",
53 "documents": [
54 {
55 "_id": 1
56 }
57 ],
58 "ordered": true,
59 "lsid": "session0",
60 "txnNumber": {
61 "$numberLong": "1"
62 },
63 "startTransaction": true,
64 "autocommit": false,
65 "readConcern": null,
66 "writeConcern": null
67 },
68 "command_name": "insert",
69 "database_name": "withTransaction-tests"
70 }
71 },
72 {
73 "command_started_event": {
74 "command": {
75 "commitTransaction": 1,
76 "lsid": "session0",
77 "txnNumber": {
78 "$numberLong": "1"
79 },
80 "autocommit": false,
81 "readConcern": null,
82 "startTransaction": null,
83 "writeConcern": null
84 },
85 "command_name": "commitTransaction",
86 "database_name": "admin"
87 }
88 }
89 ],
90 "outcome": {
91 "collection": {
92 "data": [
93 {
94 "_id": 1
95 }
96 ]
97 }
98 }
99 },
100 {
101 "description": "withTransaction inherits transaction options from client",
102 "useMultipleMongoses": true,
103 "clientOptions": {
104 "readConcernLevel": "local",
105 "w": 1
106 },
107 "operations": [
108 {
109 "name": "withTransaction",
110 "object": "session0",
111 "arguments": {
112 "callback": {
113 "operations": [
114 {
115 "name": "insertOne",
116 "object": "collection",
117 "arguments": {
118 "session": "session0",
119 "document": {
120 "_id": 1
121 }
122 },
123 "result": {
124 "insertedId": 1
125 }
126 }
127 ]
128 }
129 }
130 }
131 ],
132 "expectations": [
133 {
134 "command_started_event": {
135 "command": {
136 "insert": "test",
137 "documents": [
138 {
139 "_id": 1
140 }
141 ],
142 "ordered": true,
143 "lsid": "session0",
144 "txnNumber": {
145 "$numberLong": "1"
146 },
147 "startTransaction": true,
148 "autocommit": false,
149 "readConcern": {
150 "level": "local"
151 },
152 "writeConcern": null
153 },
154 "command_name": "insert",
155 "database_name": "withTransaction-tests"
156 }
157 },
158 {
159 "command_started_event": {
160 "command": {
161 "commitTransaction": 1,
162 "lsid": "session0",
163 "txnNumber": {
164 "$numberLong": "1"
165 },
166 "autocommit": false,
167 "writeConcern": {
168 "w": 1
169 },
170 "readConcern": null,
171 "startTransaction": null
172 },
173 "command_name": "commitTransaction",
174 "database_name": "admin"
175 }
176 }
177 ],
178 "outcome": {
179 "collection": {
180 "data": [
181 {
182 "_id": 1
183 }
184 ]
185 }
186 }
187 },
188 {
189 "description": "withTransaction inherits transaction options from defaultTransactionOptions",
190 "useMultipleMongoses": true,
191 "sessionOptions": {
192 "session0": {
193 "defaultTransactionOptions": {
194 "readConcern": {
195 "level": "majority"
196 },
197 "writeConcern": {
198 "w": 1
199 }
200 }
201 }
202 },
203 "operations": [
204 {
205 "name": "withTransaction",
206 "object": "session0",
207 "arguments": {
208 "callback": {
209 "operations": [
210 {
211 "name": "insertOne",
212 "object": "collection",
213 "arguments": {
214 "session": "session0",
215 "document": {
216 "_id": 1
217 }
218 },
219 "result": {
220 "insertedId": 1
221 }
222 }
223 ]
224 }
225 }
226 }
227 ],
228 "expectations": [
229 {
230 "command_started_event": {
231 "command": {
232 "insert": "test",
233 "documents": [
234 {
235 "_id": 1
236 }
237 ],
238 "ordered": true,
239 "lsid": "session0",
240 "txnNumber": {
241 "$numberLong": "1"
242 },
243 "startTransaction": true,
244 "autocommit": false,
245 "readConcern": {
246 "level": "majority"
247 },
248 "writeConcern": null
249 },
250 "command_name": "insert",
251 "database_name": "withTransaction-tests"
252 }
253 },
254 {
255 "command_started_event": {
256 "command": {
257 "commitTransaction": 1,
258 "lsid": "session0",
259 "txnNumber": {
260 "$numberLong": "1"
261 },
262 "autocommit": false,
263 "writeConcern": {
264 "w": 1
265 },
266 "readConcern": null,
267 "startTransaction": null
268 },
269 "command_name": "commitTransaction",
270 "database_name": "admin"
271 }
272 }
273 ],
274 "outcome": {
275 "collection": {
276 "data": [
277 {
278 "_id": 1
279 }
280 ]
281 }
282 }
283 },
284 {
285 "description": "withTransaction explicit transaction options",
286 "useMultipleMongoses": true,
287 "operations": [
288 {
289 "name": "withTransaction",
290 "object": "session0",
291 "arguments": {
292 "callback": {
293 "operations": [
294 {
295 "name": "insertOne",
296 "object": "collection",
297 "arguments": {
298 "session": "session0",
299 "document": {
300 "_id": 1
301 }
302 },
303 "result": {
304 "insertedId": 1
305 }
306 }
307 ]
308 },
309 "options": {
310 "readConcern": {
311 "level": "majority"
312 },
313 "writeConcern": {
314 "w": 1
315 }
316 }
317 }
318 }
319 ],
320 "expectations": [
321 {
322 "command_started_event": {
323 "command": {
324 "insert": "test",
325 "documents": [
326 {
327 "_id": 1
328 }
329 ],
330 "ordered": true,
331 "lsid": "session0",
332 "txnNumber": {
333 "$numberLong": "1"
334 },
335 "startTransaction": true,
336 "autocommit": false,
337 "readConcern": {
338 "level": "majority"
339 },
340 "writeConcern": null
341 },
342 "command_name": "insert",
343 "database_name": "withTransaction-tests"
344 }
345 },
346 {
347 "command_started_event": {
348 "command": {
349 "commitTransaction": 1,
350 "lsid": "session0",
351 "txnNumber": {
352 "$numberLong": "1"
353 },
354 "autocommit": false,
355 "writeConcern": {
356 "w": 1
357 },
358 "readConcern": null,
359 "startTransaction": null
360 },
361 "command_name": "commitTransaction",
362 "database_name": "admin"
363 }
364 }
365 ],
366 "outcome": {
367 "collection": {
368 "data": [
369 {
370 "_id": 1
371 }
372 ]
373 }
374 }
375 },
376 {
377 "description": "withTransaction explicit transaction options override defaultTransactionOptions",
378 "useMultipleMongoses": true,
379 "sessionOptions": {
380 "session0": {
381 "defaultTransactionOptions": {
382 "readConcern": {
383 "level": "snapshot"
384 },
385 "writeConcern": {
386 "w": "majority"
387 }
388 }
389 }
390 },
391 "operations": [
392 {
393 "name": "withTransaction",
394 "object": "session0",
395 "arguments": {
396 "callback": {
397 "operations": [
398 {
399 "name": "insertOne",
400 "object": "collection",
401 "arguments": {
402 "session": "session0",
403 "document": {
404 "_id": 1
405 }
406 },
407 "result": {
408 "insertedId": 1
409 }
410 }
411 ]
412 },
413 "options": {
414 "readConcern": {
415 "level": "majority"
416 },
417 "writeConcern": {
418 "w": 1
419 }
420 }
421 }
422 }
423 ],
424 "expectations": [
425 {
426 "command_started_event": {
427 "command": {
428 "insert": "test",
429 "documents": [
430 {
431 "_id": 1
432 }
433 ],
434 "ordered": true,
435 "lsid": "session0",
436 "txnNumber": {
437 "$numberLong": "1"
438 },
439 "startTransaction": true,
440 "autocommit": false,
441 "readConcern": {
442 "level": "majority"
443 },
444 "writeConcern": null
445 },
446 "command_name": "insert",
447 "database_name": "withTransaction-tests"
448 }
449 },
450 {
451 "command_started_event": {
452 "command": {
453 "commitTransaction": 1,
454 "lsid": "session0",
455 "txnNumber": {
456 "$numberLong": "1"
457 },
458 "autocommit": false,
459 "writeConcern": {
460 "w": 1
461 },
462 "readConcern": null,
463 "startTransaction": null
464 },
465 "command_name": "commitTransaction",
466 "database_name": "admin"
467 }
468 }
469 ],
470 "outcome": {
471 "collection": {
472 "data": [
473 {
474 "_id": 1
475 }
476 ]
477 }
478 }
479 },
480 {
481 "description": "withTransaction explicit transaction options override client options",
482 "useMultipleMongoses": true,
483 "clientOptions": {
484 "readConcernLevel": "local",
485 "w": "majority"
486 },
487 "operations": [
488 {
489 "name": "withTransaction",
490 "object": "session0",
491 "arguments": {
492 "callback": {
493 "operations": [
494 {
495 "name": "insertOne",
496 "object": "collection",
497 "arguments": {
498 "session": "session0",
499 "document": {
500 "_id": 1
501 }
502 },
503 "result": {
504 "insertedId": 1
505 }
506 }
507 ]
508 },
509 "options": {
510 "readConcern": {
511 "level": "majority"
512 },
513 "writeConcern": {
514 "w": 1
515 }
516 }
517 }
518 }
519 ],
520 "expectations": [
521 {
522 "command_started_event": {
523 "command": {
524 "insert": "test",
525 "documents": [
526 {
527 "_id": 1
528 }
529 ],
530 "ordered": true,
531 "lsid": "session0",
532 "txnNumber": {
533 "$numberLong": "1"
534 },
535 "startTransaction": true,
536 "autocommit": false,
537 "readConcern": {
538 "level": "majority"
539 },
540 "writeConcern": null
541 },
542 "command_name": "insert",
543 "database_name": "withTransaction-tests"
544 }
545 },
546 {
547 "command_started_event": {
548 "command": {
549 "commitTransaction": 1,
550 "lsid": "session0",
551 "txnNumber": {
552 "$numberLong": "1"
553 },
554 "autocommit": false,
555 "writeConcern": {
556 "w": 1
557 },
558 "readConcern": null,
559 "startTransaction": null
560 },
561 "command_name": "commitTransaction",
562 "database_name": "admin"
563 }
564 }
565 ],
566 "outcome": {
567 "collection": {
568 "data": [
569 {
570 "_id": 1
571 }
572 ]
573 }
574 }
575 }
576 ]
577}
View as plain text