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