...

Text file src/go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass/poc-sessions.json

Documentation: go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass

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

View as plain text