...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-operations-timeout/bulkWrite.json

Documentation: go.mongodb.org/mongo-driver/testdata/client-side-operations-timeout

     1{
     2  "description": "timeoutMS behaves correctly for bulkWrite operations",
     3  "schemaVersion": "1.9",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "4.4"
     7    }
     8  ],
     9  "createEntities": [
    10    {
    11      "client": {
    12        "id": "failPointClient",
    13        "useMultipleMongoses": false
    14      }
    15    },
    16    {
    17      "client": {
    18        "id": "client",
    19        "useMultipleMongoses": false,
    20        "observeEvents": [
    21          "commandStartedEvent"
    22        ]
    23      }
    24    },
    25    {
    26      "database": {
    27        "id": "database",
    28        "client": "client",
    29        "databaseName": "test"
    30      }
    31    },
    32    {
    33      "collection": {
    34        "id": "collection",
    35        "database": "database",
    36        "collectionName": "coll"
    37      }
    38    }
    39  ],
    40  "initialData": [
    41    {
    42      "collectionName": "coll",
    43      "databaseName": "test",
    44      "documents": []
    45    }
    46  ],
    47  "tests": [
    48    {
    49      "description": "timeoutMS applied to entire bulkWrite, not individual commands",
    50      "operations": [
    51        {
    52          "name": "failPoint",
    53          "object": "testRunner",
    54          "arguments": {
    55            "client": "failPointClient",
    56            "failPoint": {
    57              "configureFailPoint": "failCommand",
    58              "mode": {
    59                "times": 2
    60              },
    61              "data": {
    62                "failCommands": [
    63                  "insert",
    64                  "update"
    65                ],
    66                "blockConnection": true,
    67                "blockTimeMS": 120
    68              }
    69            }
    70          }
    71        },
    72        {
    73          "name": "find",
    74          "object": "collection",
    75          "arguments": {
    76            "filter": {
    77              "_id": 1
    78            }
    79          }
    80        },
    81        {
    82          "name": "bulkWrite",
    83          "object": "collection",
    84          "arguments": {
    85            "requests": [
    86              {
    87                "insertOne": {
    88                  "document": {
    89                    "_id": 1
    90                  }
    91                }
    92              },
    93              {
    94                "replaceOne": {
    95                  "filter": {
    96                    "_id": 1
    97                  },
    98                  "replacement": {
    99                    "x": 1
   100                  }
   101                }
   102              }
   103            ],
   104            "timeoutMS": 200
   105          },
   106          "expectError": {
   107            "isTimeoutError": true
   108          }
   109        }
   110      ],
   111      "expectEvents": [
   112        {
   113          "client": "client",
   114          "events": [
   115            {
   116              "commandStartedEvent": {
   117                "commandName": "find",
   118                "databaseName": "test",
   119                "command": {
   120                  "find": "coll"
   121                }
   122              }
   123            },
   124            {
   125              "commandStartedEvent": {
   126                "commandName": "insert",
   127                "databaseName": "test",
   128                "command": {
   129                  "insert": "coll",
   130                  "maxTimeMS": {
   131                    "$$type": [
   132                      "int",
   133                      "long"
   134                    ]
   135                  }
   136                }
   137              }
   138            },
   139            {
   140              "commandStartedEvent": {
   141                "commandName": "update",
   142                "databaseName": "test",
   143                "command": {
   144                  "update": "coll",
   145                  "maxTimeMS": {
   146                    "$$type": [
   147                      "int",
   148                      "long"
   149                    ]
   150                  }
   151                }
   152              }
   153            }
   154          ]
   155        }
   156      ]
   157    }
   158  ]
   159}

View as plain text