...

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

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

     1{
     2  "description": "MaxTimeMSExpired server errors are transformed into a custom timeout error",
     3  "schemaVersion": "1.9",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "4.0",
     7      "topologies": [
     8        "replicaset"
     9      ]
    10    },
    11    {
    12      "minServerVersion": "4.2",
    13      "topologies": [
    14        "replicaset",
    15        "sharded"
    16      ]
    17    }
    18  ],
    19  "createEntities": [
    20    {
    21      "client": {
    22        "id": "failPointClient",
    23        "useMultipleMongoses": false
    24      }
    25    },
    26    {
    27      "client": {
    28        "id": "client",
    29        "uriOptions": {
    30          "timeoutMS": 50
    31        },
    32        "useMultipleMongoses": false,
    33        "observeEvents": [
    34          "commandStartedEvent"
    35        ]
    36      }
    37    },
    38    {
    39      "database": {
    40        "id": "database",
    41        "client": "client",
    42        "databaseName": "test"
    43      }
    44    },
    45    {
    46      "collection": {
    47        "id": "collection",
    48        "database": "database",
    49        "collectionName": "coll"
    50      }
    51    }
    52  ],
    53  "initialData": [
    54    {
    55      "collectionName": "coll",
    56      "databaseName": "test",
    57      "documents": []
    58    }
    59  ],
    60  "tests": [
    61    {
    62      "description": "basic MaxTimeMSExpired error is transformed",
    63      "operations": [
    64        {
    65          "name": "failPoint",
    66          "object": "testRunner",
    67          "arguments": {
    68            "client": "failPointClient",
    69            "failPoint": {
    70              "configureFailPoint": "failCommand",
    71              "mode": {
    72                "times": 1
    73              },
    74              "data": {
    75                "failCommands": [
    76                  "insert"
    77                ],
    78                "errorCode": 50
    79              }
    80            }
    81          }
    82        },
    83        {
    84          "name": "insertOne",
    85          "object": "collection",
    86          "arguments": {
    87            "document": {
    88              "_id": 1
    89            }
    90          },
    91          "expectError": {
    92            "isTimeoutError": true
    93          }
    94        }
    95      ],
    96      "expectEvents": [
    97        {
    98          "client": "client",
    99          "events": [
   100            {
   101              "commandStartedEvent": {
   102                "commandName": "insert",
   103                "databaseName": "test",
   104                "command": {
   105                  "insert": "coll",
   106                  "maxTimeMS": {
   107                    "$$type": [
   108                      "int",
   109                      "long"
   110                    ]
   111                  }
   112                }
   113              }
   114            }
   115          ]
   116        }
   117      ]
   118    },
   119    {
   120      "description": "write concern error MaxTimeMSExpired is transformed",
   121      "operations": [
   122        {
   123          "name": "failPoint",
   124          "object": "testRunner",
   125          "arguments": {
   126            "client": "failPointClient",
   127            "failPoint": {
   128              "configureFailPoint": "failCommand",
   129              "mode": {
   130                "times": 1
   131              },
   132              "data": {
   133                "failCommands": [
   134                  "insert"
   135                ],
   136                "writeConcernError": {
   137                  "code": 50,
   138                  "errmsg": "maxTimeMS expired"
   139                }
   140              }
   141            }
   142          }
   143        },
   144        {
   145          "name": "insertOne",
   146          "object": "collection",
   147          "arguments": {
   148            "document": {
   149              "_id": 1
   150            }
   151          },
   152          "expectError": {
   153            "isTimeoutError": true
   154          }
   155        }
   156      ],
   157      "expectEvents": [
   158        {
   159          "client": "client",
   160          "events": [
   161            {
   162              "commandStartedEvent": {
   163                "commandName": "insert",
   164                "databaseName": "test",
   165                "command": {
   166                  "insert": "coll",
   167                  "maxTimeMS": {
   168                    "$$type": [
   169                      "int",
   170                      "long"
   171                    ]
   172                  }
   173                }
   174              }
   175            }
   176          ]
   177        }
   178      ]
   179    }
   180  ]
   181}

View as plain text