...

Text file src/go.mongodb.org/mongo-driver/testdata/load-balancers/transactions.json

Documentation: go.mongodb.org/mongo-driver/testdata/load-balancers

     1{
     2  "description": "transactions are correctly pinned to connections for load-balanced clusters",
     3  "schemaVersion": "1.3",
     4  "runOnRequirements": [
     5    {
     6      "topologies": [
     7        "load-balanced"
     8      ]
     9    }
    10  ],
    11  "createEntities": [
    12    {
    13      "client": {
    14        "id": "client0",
    15        "useMultipleMongoses": true,
    16        "observeEvents": [
    17          "commandStartedEvent",
    18          "connectionReadyEvent",
    19          "connectionClosedEvent",
    20          "connectionCheckedOutEvent",
    21          "connectionCheckedInEvent"
    22        ]
    23      }
    24    },
    25    {
    26      "session": {
    27        "id": "session0",
    28        "client": "client0"
    29      }
    30    },
    31    {
    32      "database": {
    33        "id": "database0",
    34        "client": "client0",
    35        "databaseName": "database0Name"
    36      }
    37    },
    38    {
    39      "collection": {
    40        "id": "collection0",
    41        "database": "database0",
    42        "collectionName": "coll0"
    43      }
    44    }
    45  ],
    46  "initialData": [
    47    {
    48      "collectionName": "coll0",
    49      "databaseName": "database0Name",
    50      "documents": [
    51        {
    52          "_id": 1
    53        },
    54        {
    55          "_id": 2
    56        },
    57        {
    58          "_id": 3
    59        }
    60      ]
    61    }
    62  ],
    63  "_yamlAnchors": {
    64    "documents": [
    65      {
    66        "_id": 4
    67      }
    68    ]
    69  },
    70  "tests": [
    71    {
    72      "description": "sessions are reused in LB mode",
    73      "operations": [
    74        {
    75          "name": "insertOne",
    76          "object": "collection0",
    77          "arguments": {
    78            "document": {
    79              "x": 1
    80            }
    81          }
    82        },
    83        {
    84          "name": "insertOne",
    85          "object": "collection0",
    86          "arguments": {
    87            "document": {
    88              "x": 1
    89            }
    90          }
    91        },
    92        {
    93          "name": "assertSameLsidOnLastTwoCommands",
    94          "object": "testRunner",
    95          "arguments": {
    96            "client": "client0"
    97          }
    98        }
    99      ]
   100    },
   101    {
   102      "description": "all operations go to the same mongos",
   103      "operations": [
   104        {
   105          "name": "startTransaction",
   106          "object": "session0"
   107        },
   108        {
   109          "name": "insertOne",
   110          "object": "collection0",
   111          "arguments": {
   112            "document": {
   113              "x": 1
   114            },
   115            "session": "session0"
   116          }
   117        },
   118        {
   119          "name": "assertNumberConnectionsCheckedOut",
   120          "object": "testRunner",
   121          "arguments": {
   122            "client": "client0",
   123            "connections": 1
   124          }
   125        },
   126        {
   127          "name": "insertOne",
   128          "object": "collection0",
   129          "arguments": {
   130            "document": {
   131              "x": 1
   132            },
   133            "session": "session0"
   134          }
   135        },
   136        {
   137          "name": "insertOne",
   138          "object": "collection0",
   139          "arguments": {
   140            "document": {
   141              "x": 1
   142            },
   143            "session": "session0"
   144          }
   145        },
   146        {
   147          "name": "insertOne",
   148          "object": "collection0",
   149          "arguments": {
   150            "document": {
   151              "x": 1
   152            },
   153            "session": "session0"
   154          }
   155        },
   156        {
   157          "name": "insertOne",
   158          "object": "collection0",
   159          "arguments": {
   160            "document": {
   161              "x": 1
   162            },
   163            "session": "session0"
   164          }
   165        },
   166        {
   167          "name": "insertOne",
   168          "object": "collection0",
   169          "arguments": {
   170            "document": {
   171              "x": 1
   172            },
   173            "session": "session0"
   174          }
   175        },
   176        {
   177          "name": "assertNumberConnectionsCheckedOut",
   178          "object": "testRunner",
   179          "arguments": {
   180            "client": "client0",
   181            "connections": 1
   182          }
   183        },
   184        {
   185          "name": "commitTransaction",
   186          "object": "session0"
   187        }
   188      ],
   189      "expectEvents": [
   190        {
   191          "client": "client0",
   192          "events": [
   193            {
   194              "commandStartedEvent": {
   195                "commandName": "insert"
   196              }
   197            },
   198            {
   199              "commandStartedEvent": {
   200                "commandName": "insert"
   201              }
   202            },
   203            {
   204              "commandStartedEvent": {
   205                "commandName": "insert"
   206              }
   207            },
   208            {
   209              "commandStartedEvent": {
   210                "commandName": "insert"
   211              }
   212            },
   213            {
   214              "commandStartedEvent": {
   215                "commandName": "insert"
   216              }
   217            },
   218            {
   219              "commandStartedEvent": {
   220                "commandName": "insert"
   221              }
   222            },
   223            {
   224              "commandStartedEvent": {
   225                "commandName": "commitTransaction"
   226              }
   227            }
   228          ]
   229        },
   230        {
   231          "client": "client0",
   232          "eventType": "cmap",
   233          "events": [
   234            {
   235              "connectionReadyEvent": {}
   236            },
   237            {
   238              "connectionCheckedOutEvent": {}
   239            }
   240          ]
   241        }
   242      ]
   243    },
   244    {
   245      "description": "transaction can be committed multiple times",
   246      "operations": [
   247        {
   248          "name": "startTransaction",
   249          "object": "session0"
   250        },
   251        {
   252          "name": "insertOne",
   253          "object": "collection0",
   254          "arguments": {
   255            "document": {
   256              "x": 1
   257            },
   258            "session": "session0"
   259          }
   260        },
   261        {
   262          "name": "assertNumberConnectionsCheckedOut",
   263          "object": "testRunner",
   264          "arguments": {
   265            "client": "client0",
   266            "connections": 1
   267          }
   268        },
   269        {
   270          "name": "commitTransaction",
   271          "object": "session0"
   272        },
   273        {
   274          "name": "assertNumberConnectionsCheckedOut",
   275          "object": "testRunner",
   276          "arguments": {
   277            "client": "client0",
   278            "connections": 1
   279          }
   280        },
   281        {
   282          "name": "commitTransaction",
   283          "object": "session0"
   284        },
   285        {
   286          "name": "commitTransaction",
   287          "object": "session0"
   288        },
   289        {
   290          "name": "commitTransaction",
   291          "object": "session0"
   292        },
   293        {
   294          "name": "assertNumberConnectionsCheckedOut",
   295          "object": "testRunner",
   296          "arguments": {
   297            "client": "client0",
   298            "connections": 1
   299          }
   300        }
   301      ],
   302      "expectEvents": [
   303        {
   304          "client": "client0",
   305          "events": [
   306            {
   307              "commandStartedEvent": {
   308                "commandName": "insert"
   309              }
   310            },
   311            {
   312              "commandStartedEvent": {
   313                "commandName": "commitTransaction"
   314              }
   315            },
   316            {
   317              "commandStartedEvent": {
   318                "commandName": "commitTransaction"
   319              }
   320            },
   321            {
   322              "commandStartedEvent": {
   323                "commandName": "commitTransaction"
   324              }
   325            },
   326            {
   327              "commandStartedEvent": {
   328                "commandName": "commitTransaction"
   329              }
   330            }
   331          ]
   332        },
   333        {
   334          "client": "client0",
   335          "eventType": "cmap",
   336          "events": [
   337            {
   338              "connectionReadyEvent": {}
   339            },
   340            {
   341              "connectionCheckedOutEvent": {}
   342            }
   343          ]
   344        }
   345      ]
   346    },
   347    {
   348      "description": "pinned connection is not released after a non-transient CRUD error",
   349      "operations": [
   350        {
   351          "name": "failPoint",
   352          "object": "testRunner",
   353          "arguments": {
   354            "client": "client0",
   355            "failPoint": {
   356              "configureFailPoint": "failCommand",
   357              "mode": {
   358                "times": 1
   359              },
   360              "data": {
   361                "failCommands": [
   362                  "insert"
   363                ],
   364                "errorCode": 51
   365              }
   366            }
   367          }
   368        },
   369        {
   370          "name": "startTransaction",
   371          "object": "session0"
   372        },
   373        {
   374          "name": "insertOne",
   375          "object": "collection0",
   376          "arguments": {
   377            "document": {
   378              "x": 1
   379            },
   380            "session": "session0"
   381          },
   382          "expectError": {
   383            "errorCode": 51,
   384            "errorLabelsOmit": [
   385              "TransientTransactionError"
   386            ]
   387          }
   388        },
   389        {
   390          "name": "assertNumberConnectionsCheckedOut",
   391          "object": "testRunner",
   392          "arguments": {
   393            "client": "client0",
   394            "connections": 1
   395          }
   396        }
   397      ],
   398      "expectEvents": [
   399        {
   400          "client": "client0",
   401          "events": [
   402            {
   403              "commandStartedEvent": {
   404                "commandName": "insert"
   405              }
   406            }
   407          ]
   408        },
   409        {
   410          "client": "client0",
   411          "eventType": "cmap",
   412          "events": [
   413            {
   414              "connectionReadyEvent": {}
   415            },
   416            {
   417              "connectionCheckedOutEvent": {}
   418            },
   419            {
   420              "connectionCheckedInEvent": {}
   421            },
   422            {
   423              "connectionCheckedOutEvent": {}
   424            }
   425          ]
   426        }
   427      ]
   428    },
   429    {
   430      "description": "pinned connection is not released after a non-transient commit error",
   431      "operations": [
   432        {
   433          "name": "failPoint",
   434          "object": "testRunner",
   435          "arguments": {
   436            "client": "client0",
   437            "failPoint": {
   438              "configureFailPoint": "failCommand",
   439              "mode": {
   440                "times": 1
   441              },
   442              "data": {
   443                "failCommands": [
   444                  "commitTransaction"
   445                ],
   446                "errorCode": 51
   447              }
   448            }
   449          }
   450        },
   451        {
   452          "name": "startTransaction",
   453          "object": "session0"
   454        },
   455        {
   456          "name": "insertOne",
   457          "object": "collection0",
   458          "arguments": {
   459            "document": {
   460              "x": 1
   461            },
   462            "session": "session0"
   463          }
   464        },
   465        {
   466          "name": "commitTransaction",
   467          "object": "session0",
   468          "expectError": {
   469            "errorCode": 51,
   470            "errorLabelsOmit": [
   471              "TransientTransactionError"
   472            ]
   473          }
   474        },
   475        {
   476          "name": "assertNumberConnectionsCheckedOut",
   477          "object": "testRunner",
   478          "arguments": {
   479            "client": "client0",
   480            "connections": 1
   481          }
   482        }
   483      ],
   484      "expectEvents": [
   485        {
   486          "client": "client0",
   487          "events": [
   488            {
   489              "commandStartedEvent": {
   490                "commandName": "insert"
   491              }
   492            },
   493            {
   494              "commandStartedEvent": {
   495                "commandName": "commitTransaction"
   496              }
   497            }
   498          ]
   499        },
   500        {
   501          "client": "client0",
   502          "eventType": "cmap",
   503          "events": [
   504            {
   505              "connectionReadyEvent": {}
   506            },
   507            {
   508              "connectionCheckedOutEvent": {}
   509            },
   510            {
   511              "connectionCheckedInEvent": {}
   512            },
   513            {
   514              "connectionCheckedOutEvent": {}
   515            }
   516          ]
   517        }
   518      ]
   519    },
   520    {
   521      "description": "pinned connection is released after a non-transient abort error",
   522      "operations": [
   523        {
   524          "name": "failPoint",
   525          "object": "testRunner",
   526          "arguments": {
   527            "client": "client0",
   528            "failPoint": {
   529              "configureFailPoint": "failCommand",
   530              "mode": {
   531                "times": 1
   532              },
   533              "data": {
   534                "failCommands": [
   535                  "abortTransaction"
   536                ],
   537                "errorCode": 51
   538              }
   539            }
   540          }
   541        },
   542        {
   543          "name": "startTransaction",
   544          "object": "session0"
   545        },
   546        {
   547          "name": "insertOne",
   548          "object": "collection0",
   549          "arguments": {
   550            "document": {
   551              "x": 1
   552            },
   553            "session": "session0"
   554          }
   555        },
   556        {
   557          "name": "abortTransaction",
   558          "object": "session0"
   559        },
   560        {
   561          "name": "assertNumberConnectionsCheckedOut",
   562          "object": "testRunner",
   563          "arguments": {
   564            "client": "client0",
   565            "connections": 0
   566          }
   567        }
   568      ],
   569      "expectEvents": [
   570        {
   571          "client": "client0",
   572          "events": [
   573            {
   574              "commandStartedEvent": {
   575                "commandName": "insert"
   576              }
   577            },
   578            {
   579              "commandStartedEvent": {
   580                "commandName": "abortTransaction"
   581              }
   582            }
   583          ]
   584        },
   585        {
   586          "client": "client0",
   587          "eventType": "cmap",
   588          "events": [
   589            {
   590              "connectionReadyEvent": {}
   591            },
   592            {
   593              "connectionCheckedOutEvent": {}
   594            },
   595            {
   596              "connectionCheckedInEvent": {}
   597            },
   598            {
   599              "connectionCheckedOutEvent": {}
   600            },
   601            {
   602              "connectionCheckedInEvent": {}
   603            }
   604          ]
   605        }
   606      ]
   607    },
   608    {
   609      "description": "pinned connection is released after a transient non-network CRUD error",
   610      "runOnRequirements": [
   611        {
   612          "serverless": "forbid"
   613        }
   614      ],
   615      "operations": [
   616        {
   617          "name": "failPoint",
   618          "object": "testRunner",
   619          "arguments": {
   620            "client": "client0",
   621            "failPoint": {
   622              "configureFailPoint": "failCommand",
   623              "mode": {
   624                "times": 1
   625              },
   626              "data": {
   627                "failCommands": [
   628                  "insert"
   629                ],
   630                "errorCode": 24
   631              }
   632            }
   633          }
   634        },
   635        {
   636          "name": "startTransaction",
   637          "object": "session0"
   638        },
   639        {
   640          "name": "insertOne",
   641          "object": "collection0",
   642          "arguments": {
   643            "document": {
   644              "x": 1
   645            },
   646            "session": "session0"
   647          },
   648          "expectError": {
   649            "errorCode": 24,
   650            "errorLabelsContain": [
   651              "TransientTransactionError"
   652            ]
   653          }
   654        },
   655        {
   656          "name": "assertNumberConnectionsCheckedOut",
   657          "object": "testRunner",
   658          "arguments": {
   659            "client": "client0",
   660            "connections": 0
   661          }
   662        },
   663        {
   664          "name": "abortTransaction",
   665          "object": "session0"
   666        },
   667        {
   668          "name": "assertNumberConnectionsCheckedOut",
   669          "object": "testRunner",
   670          "arguments": {
   671            "client": "client0",
   672            "connections": 0
   673          }
   674        }
   675      ],
   676      "expectEvents": [
   677        {
   678          "client": "client0",
   679          "events": [
   680            {
   681              "commandStartedEvent": {
   682                "commandName": "insert"
   683              }
   684            },
   685            {
   686              "commandStartedEvent": {
   687                "commandName": "abortTransaction"
   688              }
   689            }
   690          ]
   691        },
   692        {
   693          "client": "client0",
   694          "eventType": "cmap",
   695          "events": [
   696            {
   697              "connectionReadyEvent": {}
   698            },
   699            {
   700              "connectionCheckedOutEvent": {}
   701            },
   702            {
   703              "connectionCheckedInEvent": {}
   704            },
   705            {
   706              "connectionCheckedOutEvent": {}
   707            },
   708            {
   709              "connectionCheckedInEvent": {}
   710            },
   711            {
   712              "connectionCheckedOutEvent": {}
   713            },
   714            {
   715              "connectionCheckedInEvent": {}
   716            }
   717          ]
   718        }
   719      ]
   720    },
   721    {
   722      "description": "pinned connection is released after a transient network CRUD error",
   723      "runOnRequirements": [
   724        {
   725          "serverless": "forbid"
   726        }
   727      ],
   728      "operations": [
   729        {
   730          "name": "failPoint",
   731          "object": "testRunner",
   732          "arguments": {
   733            "client": "client0",
   734            "failPoint": {
   735              "configureFailPoint": "failCommand",
   736              "mode": {
   737                "times": 1
   738              },
   739              "data": {
   740                "failCommands": [
   741                  "insert"
   742                ],
   743                "closeConnection": true
   744              }
   745            }
   746          }
   747        },
   748        {
   749          "name": "startTransaction",
   750          "object": "session0"
   751        },
   752        {
   753          "name": "insertOne",
   754          "object": "collection0",
   755          "arguments": {
   756            "document": {
   757              "x": 1
   758            },
   759            "session": "session0"
   760          },
   761          "expectError": {
   762            "isClientError": true,
   763            "errorLabelsContain": [
   764              "TransientTransactionError"
   765            ]
   766          }
   767        },
   768        {
   769          "name": "assertNumberConnectionsCheckedOut",
   770          "object": "testRunner",
   771          "arguments": {
   772            "client": "client0",
   773            "connections": 0
   774          }
   775        },
   776        {
   777          "name": "abortTransaction",
   778          "object": "session0"
   779        },
   780        {
   781          "name": "assertNumberConnectionsCheckedOut",
   782          "object": "testRunner",
   783          "arguments": {
   784            "client": "client0",
   785            "connections": 0
   786          }
   787        }
   788      ],
   789      "expectEvents": [
   790        {
   791          "client": "client0",
   792          "events": [
   793            {
   794              "commandStartedEvent": {
   795                "commandName": "insert"
   796              }
   797            },
   798            {
   799              "commandStartedEvent": {
   800                "commandName": "abortTransaction"
   801              }
   802            }
   803          ]
   804        },
   805        {
   806          "client": "client0",
   807          "eventType": "cmap",
   808          "events": [
   809            {
   810              "connectionReadyEvent": {}
   811            },
   812            {
   813              "connectionCheckedOutEvent": {}
   814            },
   815            {
   816              "connectionCheckedInEvent": {}
   817            },
   818            {
   819              "connectionCheckedOutEvent": {}
   820            },
   821            {
   822              "connectionCheckedInEvent": {}
   823            },
   824            {
   825              "connectionClosedEvent": {
   826                "reason": "error"
   827              }
   828            },
   829            {
   830              "connectionReadyEvent": {}
   831            },
   832            {
   833              "connectionCheckedOutEvent": {}
   834            },
   835            {
   836              "connectionCheckedInEvent": {}
   837            }
   838          ]
   839        }
   840      ]
   841    },
   842    {
   843      "description": "pinned connection is released after a transient non-network commit error",
   844      "runOnRequirements": [
   845        {
   846          "serverless": "forbid"
   847        }
   848      ],
   849      "operations": [
   850        {
   851          "name": "failPoint",
   852          "object": "testRunner",
   853          "arguments": {
   854            "client": "client0",
   855            "failPoint": {
   856              "configureFailPoint": "failCommand",
   857              "mode": {
   858                "times": 1
   859              },
   860              "data": {
   861                "failCommands": [
   862                  "commitTransaction"
   863                ],
   864                "errorCode": 24
   865              }
   866            }
   867          }
   868        },
   869        {
   870          "name": "startTransaction",
   871          "object": "session0"
   872        },
   873        {
   874          "name": "insertOne",
   875          "object": "collection0",
   876          "arguments": {
   877            "document": {
   878              "x": 1
   879            },
   880            "session": "session0"
   881          }
   882        },
   883        {
   884          "name": "commitTransaction",
   885          "object": "session0",
   886          "expectError": {
   887            "errorCode": 24,
   888            "errorLabelsContain": [
   889              "TransientTransactionError"
   890            ]
   891          }
   892        },
   893        {
   894          "name": "assertNumberConnectionsCheckedOut",
   895          "object": "testRunner",
   896          "arguments": {
   897            "client": "client0",
   898            "connections": 0
   899          }
   900        }
   901      ],
   902      "expectEvents": [
   903        {
   904          "client": "client0",
   905          "events": [
   906            {
   907              "commandStartedEvent": {
   908                "commandName": "insert"
   909              }
   910            },
   911            {
   912              "commandStartedEvent": {
   913                "commandName": "commitTransaction"
   914              }
   915            }
   916          ]
   917        },
   918        {
   919          "client": "client0",
   920          "eventType": "cmap",
   921          "events": [
   922            {
   923              "connectionReadyEvent": {}
   924            },
   925            {
   926              "connectionCheckedOutEvent": {}
   927            },
   928            {
   929              "connectionCheckedInEvent": {}
   930            },
   931            {
   932              "connectionCheckedOutEvent": {}
   933            },
   934            {
   935              "connectionCheckedInEvent": {}
   936            }
   937          ]
   938        }
   939      ]
   940    },
   941    {
   942      "description": "pinned connection is released after a transient network commit error",
   943      "operations": [
   944        {
   945          "name": "failPoint",
   946          "object": "testRunner",
   947          "arguments": {
   948            "client": "client0",
   949            "failPoint": {
   950              "configureFailPoint": "failCommand",
   951              "mode": {
   952                "times": 1
   953              },
   954              "data": {
   955                "failCommands": [
   956                  "commitTransaction"
   957                ],
   958                "closeConnection": true
   959              }
   960            }
   961          }
   962        },
   963        {
   964          "name": "startTransaction",
   965          "object": "session0"
   966        },
   967        {
   968          "name": "insertOne",
   969          "object": "collection0",
   970          "arguments": {
   971            "document": {
   972              "x": 1
   973            },
   974            "session": "session0"
   975          }
   976        },
   977        {
   978          "name": "commitTransaction",
   979          "object": "session0",
   980          "ignoreResultAndError": true
   981        },
   982        {
   983          "name": "assertNumberConnectionsCheckedOut",
   984          "object": "testRunner",
   985          "arguments": {
   986            "client": "client0",
   987            "connections": 0
   988          }
   989        }
   990      ],
   991      "expectEvents": [
   992        {
   993          "client": "client0",
   994          "events": [
   995            {
   996              "commandStartedEvent": {
   997                "commandName": "insert"
   998              }
   999            },
  1000            {
  1001              "commandStartedEvent": {
  1002                "commandName": "commitTransaction"
  1003              }
  1004            },
  1005            {
  1006              "commandStartedEvent": {
  1007                "commandName": "commitTransaction"
  1008              }
  1009            }
  1010          ]
  1011        },
  1012        {
  1013          "client": "client0",
  1014          "eventType": "cmap",
  1015          "events": [
  1016            {
  1017              "connectionReadyEvent": {}
  1018            },
  1019            {
  1020              "connectionCheckedOutEvent": {}
  1021            },
  1022            {
  1023              "connectionCheckedInEvent": {}
  1024            },
  1025            {
  1026              "connectionCheckedOutEvent": {}
  1027            },
  1028            {
  1029              "connectionCheckedInEvent": {}
  1030            },
  1031            {
  1032              "connectionClosedEvent": {
  1033                "reason": "error"
  1034              }
  1035            },
  1036            {
  1037              "connectionReadyEvent": {}
  1038            },
  1039            {
  1040              "connectionCheckedOutEvent": {}
  1041            },
  1042            {
  1043              "connectionCheckedInEvent": {}
  1044            }
  1045          ]
  1046        }
  1047      ]
  1048    },
  1049    {
  1050      "description": "pinned connection is released after a transient non-network abort error",
  1051      "operations": [
  1052        {
  1053          "name": "failPoint",
  1054          "object": "testRunner",
  1055          "arguments": {
  1056            "client": "client0",
  1057            "failPoint": {
  1058              "configureFailPoint": "failCommand",
  1059              "mode": {
  1060                "times": 1
  1061              },
  1062              "data": {
  1063                "failCommands": [
  1064                  "abortTransaction"
  1065                ],
  1066                "errorCode": 24
  1067              }
  1068            }
  1069          }
  1070        },
  1071        {
  1072          "name": "startTransaction",
  1073          "object": "session0"
  1074        },
  1075        {
  1076          "name": "insertOne",
  1077          "object": "collection0",
  1078          "arguments": {
  1079            "document": {
  1080              "x": 1
  1081            },
  1082            "session": "session0"
  1083          }
  1084        },
  1085        {
  1086          "name": "abortTransaction",
  1087          "object": "session0"
  1088        },
  1089        {
  1090          "name": "assertNumberConnectionsCheckedOut",
  1091          "object": "testRunner",
  1092          "arguments": {
  1093            "client": "client0",
  1094            "connections": 0
  1095          }
  1096        }
  1097      ],
  1098      "expectEvents": [
  1099        {
  1100          "client": "client0",
  1101          "events": [
  1102            {
  1103              "commandStartedEvent": {
  1104                "commandName": "insert"
  1105              }
  1106            },
  1107            {
  1108              "commandStartedEvent": {
  1109                "commandName": "abortTransaction"
  1110              }
  1111            }
  1112          ]
  1113        },
  1114        {
  1115          "client": "client0",
  1116          "eventType": "cmap",
  1117          "events": [
  1118            {
  1119              "connectionReadyEvent": {}
  1120            },
  1121            {
  1122              "connectionCheckedOutEvent": {}
  1123            },
  1124            {
  1125              "connectionCheckedInEvent": {}
  1126            },
  1127            {
  1128              "connectionCheckedOutEvent": {}
  1129            },
  1130            {
  1131              "connectionCheckedInEvent": {}
  1132            }
  1133          ]
  1134        }
  1135      ]
  1136    },
  1137    {
  1138      "description": "pinned connection is released after a transient network abort error",
  1139      "operations": [
  1140        {
  1141          "name": "failPoint",
  1142          "object": "testRunner",
  1143          "arguments": {
  1144            "client": "client0",
  1145            "failPoint": {
  1146              "configureFailPoint": "failCommand",
  1147              "mode": {
  1148                "times": 1
  1149              },
  1150              "data": {
  1151                "failCommands": [
  1152                  "abortTransaction"
  1153                ],
  1154                "closeConnection": true
  1155              }
  1156            }
  1157          }
  1158        },
  1159        {
  1160          "name": "startTransaction",
  1161          "object": "session0"
  1162        },
  1163        {
  1164          "name": "insertOne",
  1165          "object": "collection0",
  1166          "arguments": {
  1167            "document": {
  1168              "x": 1
  1169            },
  1170            "session": "session0"
  1171          }
  1172        },
  1173        {
  1174          "name": "abortTransaction",
  1175          "object": "session0"
  1176        },
  1177        {
  1178          "name": "assertNumberConnectionsCheckedOut",
  1179          "object": "testRunner",
  1180          "arguments": {
  1181            "client": "client0",
  1182            "connections": 0
  1183          }
  1184        }
  1185      ],
  1186      "expectEvents": [
  1187        {
  1188          "client": "client0",
  1189          "events": [
  1190            {
  1191              "commandStartedEvent": {
  1192                "commandName": "insert"
  1193              }
  1194            },
  1195            {
  1196              "commandStartedEvent": {
  1197                "commandName": "abortTransaction"
  1198              }
  1199            },
  1200            {
  1201              "commandStartedEvent": {
  1202                "commandName": "abortTransaction"
  1203              }
  1204            }
  1205          ]
  1206        },
  1207        {
  1208          "client": "client0",
  1209          "eventType": "cmap",
  1210          "events": [
  1211            {
  1212              "connectionReadyEvent": {}
  1213            },
  1214            {
  1215              "connectionCheckedOutEvent": {}
  1216            },
  1217            {
  1218              "connectionCheckedInEvent": {}
  1219            },
  1220            {
  1221              "connectionCheckedOutEvent": {}
  1222            },
  1223            {
  1224              "connectionCheckedInEvent": {}
  1225            },
  1226            {
  1227              "connectionClosedEvent": {
  1228                "reason": "error"
  1229              }
  1230            },
  1231            {
  1232              "connectionReadyEvent": {}
  1233            },
  1234            {
  1235              "connectionCheckedOutEvent": {}
  1236            },
  1237            {
  1238              "connectionCheckedInEvent": {}
  1239            }
  1240          ]
  1241        }
  1242      ]
  1243    },
  1244    {
  1245      "description": "pinned connection is released on successful abort",
  1246      "operations": [
  1247        {
  1248          "name": "startTransaction",
  1249          "object": "session0"
  1250        },
  1251        {
  1252          "name": "insertOne",
  1253          "object": "collection0",
  1254          "arguments": {
  1255            "document": {
  1256              "x": 1
  1257            },
  1258            "session": "session0"
  1259          }
  1260        },
  1261        {
  1262          "name": "abortTransaction",
  1263          "object": "session0"
  1264        },
  1265        {
  1266          "name": "assertNumberConnectionsCheckedOut",
  1267          "object": "testRunner",
  1268          "arguments": {
  1269            "client": "client0",
  1270            "connections": 0
  1271          }
  1272        }
  1273      ],
  1274      "expectEvents": [
  1275        {
  1276          "client": "client0",
  1277          "events": [
  1278            {
  1279              "commandStartedEvent": {
  1280                "commandName": "insert"
  1281              }
  1282            },
  1283            {
  1284              "commandStartedEvent": {
  1285                "commandName": "abortTransaction"
  1286              }
  1287            }
  1288          ]
  1289        },
  1290        {
  1291          "client": "client0",
  1292          "eventType": "cmap",
  1293          "events": [
  1294            {
  1295              "connectionReadyEvent": {}
  1296            },
  1297            {
  1298              "connectionCheckedOutEvent": {}
  1299            },
  1300            {
  1301              "connectionCheckedInEvent": {}
  1302            }
  1303          ]
  1304        }
  1305      ]
  1306    },
  1307    {
  1308      "description": "pinned connection is returned when a new transaction is started",
  1309      "operations": [
  1310        {
  1311          "name": "startTransaction",
  1312          "object": "session0"
  1313        },
  1314        {
  1315          "name": "insertOne",
  1316          "object": "collection0",
  1317          "arguments": {
  1318            "document": {
  1319              "x": 1
  1320            },
  1321            "session": "session0"
  1322          }
  1323        },
  1324        {
  1325          "name": "commitTransaction",
  1326          "object": "session0"
  1327        },
  1328        {
  1329          "name": "assertNumberConnectionsCheckedOut",
  1330          "object": "testRunner",
  1331          "arguments": {
  1332            "client": "client0",
  1333            "connections": 1
  1334          }
  1335        },
  1336        {
  1337          "name": "startTransaction",
  1338          "object": "session0"
  1339        },
  1340        {
  1341          "name": "assertNumberConnectionsCheckedOut",
  1342          "object": "testRunner",
  1343          "arguments": {
  1344            "client": "client0",
  1345            "connections": 0
  1346          }
  1347        },
  1348        {
  1349          "name": "insertOne",
  1350          "object": "collection0",
  1351          "arguments": {
  1352            "document": {
  1353              "x": 1
  1354            },
  1355            "session": "session0"
  1356          }
  1357        },
  1358        {
  1359          "name": "assertNumberConnectionsCheckedOut",
  1360          "object": "testRunner",
  1361          "arguments": {
  1362            "client": "client0",
  1363            "connections": 1
  1364          }
  1365        },
  1366        {
  1367          "name": "commitTransaction",
  1368          "object": "session0"
  1369        }
  1370      ],
  1371      "expectEvents": [
  1372        {
  1373          "client": "client0",
  1374          "events": [
  1375            {
  1376              "commandStartedEvent": {
  1377                "commandName": "insert"
  1378              }
  1379            },
  1380            {
  1381              "commandStartedEvent": {
  1382                "commandName": "commitTransaction"
  1383              }
  1384            },
  1385            {
  1386              "commandStartedEvent": {
  1387                "commandName": "insert"
  1388              }
  1389            },
  1390            {
  1391              "commandStartedEvent": {
  1392                "commandName": "commitTransaction"
  1393              }
  1394            }
  1395          ]
  1396        },
  1397        {
  1398          "client": "client0",
  1399          "eventType": "cmap",
  1400          "events": [
  1401            {
  1402              "connectionReadyEvent": {}
  1403            },
  1404            {
  1405              "connectionCheckedOutEvent": {}
  1406            },
  1407            {
  1408              "connectionCheckedInEvent": {}
  1409            },
  1410            {
  1411              "connectionCheckedOutEvent": {}
  1412            }
  1413          ]
  1414        }
  1415      ]
  1416    },
  1417    {
  1418      "description": "pinned connection is returned when a non-transaction operation uses the session",
  1419      "operations": [
  1420        {
  1421          "name": "startTransaction",
  1422          "object": "session0"
  1423        },
  1424        {
  1425          "name": "insertOne",
  1426          "object": "collection0",
  1427          "arguments": {
  1428            "document": {
  1429              "x": 1
  1430            },
  1431            "session": "session0"
  1432          }
  1433        },
  1434        {
  1435          "name": "commitTransaction",
  1436          "object": "session0"
  1437        },
  1438        {
  1439          "name": "assertNumberConnectionsCheckedOut",
  1440          "object": "testRunner",
  1441          "arguments": {
  1442            "client": "client0",
  1443            "connections": 1
  1444          }
  1445        },
  1446        {
  1447          "name": "insertOne",
  1448          "object": "collection0",
  1449          "arguments": {
  1450            "document": {
  1451              "x": 1
  1452            },
  1453            "session": "session0"
  1454          }
  1455        },
  1456        {
  1457          "name": "assertNumberConnectionsCheckedOut",
  1458          "object": "testRunner",
  1459          "arguments": {
  1460            "client": "client0",
  1461            "connections": 0
  1462          }
  1463        }
  1464      ],
  1465      "expectEvents": [
  1466        {
  1467          "client": "client0",
  1468          "events": [
  1469            {
  1470              "commandStartedEvent": {
  1471                "commandName": "insert"
  1472              }
  1473            },
  1474            {
  1475              "commandStartedEvent": {
  1476                "commandName": "commitTransaction"
  1477              }
  1478            },
  1479            {
  1480              "commandStartedEvent": {
  1481                "commandName": "insert"
  1482              }
  1483            }
  1484          ]
  1485        },
  1486        {
  1487          "client": "client0",
  1488          "eventType": "cmap",
  1489          "events": [
  1490            {
  1491              "connectionReadyEvent": {}
  1492            },
  1493            {
  1494              "connectionCheckedOutEvent": {}
  1495            },
  1496            {
  1497              "connectionCheckedInEvent": {}
  1498            },
  1499            {
  1500              "connectionCheckedOutEvent": {}
  1501            },
  1502            {
  1503              "connectionCheckedInEvent": {}
  1504            }
  1505          ]
  1506        }
  1507      ]
  1508    },
  1509    {
  1510      "description": "a connection can be shared by a transaction and a cursor",
  1511      "operations": [
  1512        {
  1513          "name": "startTransaction",
  1514          "object": "session0"
  1515        },
  1516        {
  1517          "name": "insertOne",
  1518          "object": "collection0",
  1519          "arguments": {
  1520            "document": {
  1521              "x": 1
  1522            },
  1523            "session": "session0"
  1524          }
  1525        },
  1526        {
  1527          "name": "assertNumberConnectionsCheckedOut",
  1528          "object": "testRunner",
  1529          "arguments": {
  1530            "client": "client0",
  1531            "connections": 1
  1532          }
  1533        },
  1534        {
  1535          "name": "createFindCursor",
  1536          "object": "collection0",
  1537          "arguments": {
  1538            "filter": {},
  1539            "batchSize": 2,
  1540            "session": "session0"
  1541          },
  1542          "saveResultAsEntity": "cursor0"
  1543        },
  1544        {
  1545          "name": "assertNumberConnectionsCheckedOut",
  1546          "object": "testRunner",
  1547          "arguments": {
  1548            "client": "client0",
  1549            "connections": 1
  1550          }
  1551        },
  1552        {
  1553          "name": "close",
  1554          "object": "cursor0"
  1555        },
  1556        {
  1557          "name": "assertNumberConnectionsCheckedOut",
  1558          "object": "testRunner",
  1559          "arguments": {
  1560            "client": "client0",
  1561            "connections": 1
  1562          }
  1563        },
  1564        {
  1565          "name": "abortTransaction",
  1566          "object": "session0"
  1567        },
  1568        {
  1569          "name": "assertNumberConnectionsCheckedOut",
  1570          "object": "testRunner",
  1571          "arguments": {
  1572            "client": "client0",
  1573            "connections": 0
  1574          }
  1575        }
  1576      ],
  1577      "expectEvents": [
  1578        {
  1579          "client": "client0",
  1580          "events": [
  1581            {
  1582              "commandStartedEvent": {
  1583                "commandName": "insert"
  1584              }
  1585            },
  1586            {
  1587              "commandStartedEvent": {
  1588                "commandName": "find"
  1589              }
  1590            },
  1591            {
  1592              "commandStartedEvent": {
  1593                "commandName": "killCursors"
  1594              }
  1595            },
  1596            {
  1597              "commandStartedEvent": {
  1598                "commandName": "abortTransaction"
  1599              }
  1600            }
  1601          ]
  1602        },
  1603        {
  1604          "client": "client0",
  1605          "eventType": "cmap",
  1606          "events": [
  1607            {
  1608              "connectionReadyEvent": {}
  1609            },
  1610            {
  1611              "connectionCheckedOutEvent": {}
  1612            },
  1613            {
  1614              "connectionCheckedInEvent": {}
  1615            }
  1616          ]
  1617        }
  1618      ]
  1619    }
  1620  ]
  1621}

View as plain text