1{
2 "description": "poc-transactions-convenient-api",
3 "schemaVersion": "1.0",
4 "runOnRequirements": [
5 {
6 "minServerVersion": "4.0",
7 "topologies": [
8 "replicaset"
9 ]
10 },
11 {
12 "minServerVersion": "4.1.8",
13 "topologies": [
14 "sharded-replicaset"
15 ]
16 }
17 ],
18 "createEntities": [
19 {
20 "client": {
21 "id": "client0",
22 "useMultipleMongoses": true,
23 "observeEvents": [
24 "commandStartedEvent"
25 ]
26 }
27 },
28 {
29 "client": {
30 "id": "client1",
31 "uriOptions": {
32 "readConcernLevel": "local",
33 "w": 1
34 },
35 "useMultipleMongoses": true,
36 "observeEvents": [
37 "commandStartedEvent"
38 ]
39 }
40 },
41 {
42 "database": {
43 "id": "database0",
44 "client": "client0",
45 "databaseName": "transaction-tests"
46 }
47 },
48 {
49 "database": {
50 "id": "database1",
51 "client": "client1",
52 "databaseName": "transaction-tests"
53 }
54 },
55 {
56 "collection": {
57 "id": "collection0",
58 "database": "database0",
59 "collectionName": "test"
60 }
61 },
62 {
63 "collection": {
64 "id": "collection1",
65 "database": "database1",
66 "collectionName": "test"
67 }
68 },
69 {
70 "session": {
71 "id": "session0",
72 "client": "client0"
73 }
74 },
75 {
76 "session": {
77 "id": "session1",
78 "client": "client1"
79 }
80 },
81 {
82 "session": {
83 "id": "session2",
84 "client": "client0",
85 "sessionOptions": {
86 "defaultTransactionOptions": {
87 "readConcern": {
88 "level": "majority"
89 },
90 "writeConcern": {
91 "w": 1
92 }
93 }
94 }
95 }
96 }
97 ],
98 "initialData": [
99 {
100 "collectionName": "test",
101 "databaseName": "transaction-tests",
102 "documents": []
103 }
104 ],
105 "tests": [
106 {
107 "description": "withTransaction and no transaction options set",
108 "operations": [
109 {
110 "name": "withTransaction",
111 "object": "session0",
112 "arguments": {
113 "callback": [
114 {
115 "name": "insertOne",
116 "object": "collection0",
117 "arguments": {
118 "session": "session0",
119 "document": {
120 "_id": 1
121 }
122 },
123 "expectResult": {
124 "$$unsetOrMatches": {
125 "insertedId": {
126 "$$unsetOrMatches": 1
127 }
128 }
129 }
130 }
131 ]
132 }
133 }
134 ],
135 "expectEvents": [
136 {
137 "client": "client0",
138 "events": [
139 {
140 "commandStartedEvent": {
141 "command": {
142 "insert": "test",
143 "documents": [
144 {
145 "_id": 1
146 }
147 ],
148 "ordered": true,
149 "lsid": {
150 "$$sessionLsid": "session0"
151 },
152 "txnNumber": 1,
153 "startTransaction": true,
154 "autocommit": false,
155 "readConcern": {
156 "$$exists": false
157 },
158 "writeConcern": {
159 "$$exists": false
160 }
161 },
162 "commandName": "insert",
163 "databaseName": "transaction-tests"
164 }
165 },
166 {
167 "commandStartedEvent": {
168 "command": {
169 "commitTransaction": 1,
170 "lsid": {
171 "$$sessionLsid": "session0"
172 },
173 "txnNumber": 1,
174 "autocommit": false,
175 "readConcern": {
176 "$$exists": false
177 },
178 "startTransaction": {
179 "$$exists": false
180 },
181 "writeConcern": {
182 "$$exists": false
183 }
184 },
185 "commandName": "commitTransaction",
186 "databaseName": "admin"
187 }
188 }
189 ]
190 }
191 ],
192 "outcome": [
193 {
194 "collectionName": "test",
195 "databaseName": "transaction-tests",
196 "documents": [
197 {
198 "_id": 1
199 }
200 ]
201 }
202 ]
203 },
204 {
205 "description": "withTransaction inherits transaction options from client",
206 "operations": [
207 {
208 "name": "withTransaction",
209 "object": "session1",
210 "arguments": {
211 "callback": [
212 {
213 "name": "insertOne",
214 "object": "collection1",
215 "arguments": {
216 "session": "session1",
217 "document": {
218 "_id": 1
219 }
220 },
221 "expectResult": {
222 "$$unsetOrMatches": {
223 "insertedId": {
224 "$$unsetOrMatches": 1
225 }
226 }
227 }
228 }
229 ]
230 }
231 }
232 ],
233 "expectEvents": [
234 {
235 "client": "client1",
236 "events": [
237 {
238 "commandStartedEvent": {
239 "command": {
240 "insert": "test",
241 "documents": [
242 {
243 "_id": 1
244 }
245 ],
246 "ordered": true,
247 "lsid": {
248 "$$sessionLsid": "session1"
249 },
250 "txnNumber": 1,
251 "startTransaction": true,
252 "autocommit": false,
253 "readConcern": {
254 "level": "local"
255 },
256 "writeConcern": {
257 "$$exists": false
258 }
259 },
260 "commandName": "insert",
261 "databaseName": "transaction-tests"
262 }
263 },
264 {
265 "commandStartedEvent": {
266 "command": {
267 "commitTransaction": 1,
268 "lsid": {
269 "$$sessionLsid": "session1"
270 },
271 "txnNumber": 1,
272 "autocommit": false,
273 "writeConcern": {
274 "w": 1
275 },
276 "readConcern": {
277 "$$exists": false
278 },
279 "startTransaction": {
280 "$$exists": false
281 }
282 },
283 "commandName": "commitTransaction",
284 "databaseName": "admin"
285 }
286 }
287 ]
288 }
289 ],
290 "outcome": [
291 {
292 "collectionName": "test",
293 "databaseName": "transaction-tests",
294 "documents": [
295 {
296 "_id": 1
297 }
298 ]
299 }
300 ]
301 },
302 {
303 "description": "withTransaction inherits transaction options from defaultTransactionOptions",
304 "operations": [
305 {
306 "name": "withTransaction",
307 "object": "session2",
308 "arguments": {
309 "callback": [
310 {
311 "name": "insertOne",
312 "object": "collection0",
313 "arguments": {
314 "session": "session2",
315 "document": {
316 "_id": 1
317 }
318 },
319 "expectResult": {
320 "$$unsetOrMatches": {
321 "insertedId": {
322 "$$unsetOrMatches": 1
323 }
324 }
325 }
326 }
327 ]
328 }
329 }
330 ],
331 "expectEvents": [
332 {
333 "client": "client0",
334 "events": [
335 {
336 "commandStartedEvent": {
337 "command": {
338 "insert": "test",
339 "documents": [
340 {
341 "_id": 1
342 }
343 ],
344 "ordered": true,
345 "lsid": {
346 "$$sessionLsid": "session2"
347 },
348 "txnNumber": 1,
349 "startTransaction": true,
350 "autocommit": false,
351 "readConcern": {
352 "level": "majority"
353 },
354 "writeConcern": {
355 "$$exists": false
356 }
357 },
358 "commandName": "insert",
359 "databaseName": "transaction-tests"
360 }
361 },
362 {
363 "commandStartedEvent": {
364 "command": {
365 "commitTransaction": 1,
366 "lsid": {
367 "$$sessionLsid": "session2"
368 },
369 "txnNumber": 1,
370 "autocommit": false,
371 "writeConcern": {
372 "w": 1
373 },
374 "readConcern": {
375 "$$exists": false
376 },
377 "startTransaction": {
378 "$$exists": false
379 }
380 },
381 "commandName": "commitTransaction",
382 "databaseName": "admin"
383 }
384 }
385 ]
386 }
387 ],
388 "outcome": [
389 {
390 "collectionName": "test",
391 "databaseName": "transaction-tests",
392 "documents": [
393 {
394 "_id": 1
395 }
396 ]
397 }
398 ]
399 },
400 {
401 "description": "withTransaction explicit transaction options",
402 "operations": [
403 {
404 "name": "withTransaction",
405 "object": "session0",
406 "arguments": {
407 "callback": [
408 {
409 "name": "insertOne",
410 "object": "collection0",
411 "arguments": {
412 "session": "session0",
413 "document": {
414 "_id": 1
415 }
416 },
417 "expectResult": {
418 "$$unsetOrMatches": {
419 "insertedId": {
420 "$$unsetOrMatches": 1
421 }
422 }
423 }
424 }
425 ],
426 "readConcern": {
427 "level": "majority"
428 },
429 "writeConcern": {
430 "w": 1
431 }
432 }
433 }
434 ],
435 "expectEvents": [
436 {
437 "client": "client0",
438 "events": [
439 {
440 "commandStartedEvent": {
441 "command": {
442 "insert": "test",
443 "documents": [
444 {
445 "_id": 1
446 }
447 ],
448 "ordered": true,
449 "lsid": {
450 "$$sessionLsid": "session0"
451 },
452 "txnNumber": 1,
453 "startTransaction": true,
454 "autocommit": false,
455 "readConcern": {
456 "level": "majority"
457 },
458 "writeConcern": {
459 "$$exists": false
460 }
461 },
462 "commandName": "insert",
463 "databaseName": "transaction-tests"
464 }
465 },
466 {
467 "commandStartedEvent": {
468 "command": {
469 "commitTransaction": 1,
470 "lsid": {
471 "$$sessionLsid": "session0"
472 },
473 "txnNumber": 1,
474 "autocommit": false,
475 "writeConcern": {
476 "w": 1
477 },
478 "readConcern": {
479 "$$exists": false
480 },
481 "startTransaction": {
482 "$$exists": false
483 }
484 },
485 "commandName": "commitTransaction",
486 "databaseName": "admin"
487 }
488 }
489 ]
490 }
491 ],
492 "outcome": [
493 {
494 "collectionName": "test",
495 "databaseName": "transaction-tests",
496 "documents": [
497 {
498 "_id": 1
499 }
500 ]
501 }
502 ]
503 }
504 ]
505}
View as plain text