...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-writes/unified/insertOne-serverErrors.json

Documentation: go.mongodb.org/mongo-driver/testdata/retryable-writes/unified

     1{
     2  "description": "retryable-writes insertOne serverErrors",
     3  "schemaVersion": "1.0",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "3.6",
     7      "topologies": [
     8        "replicaset"
     9      ]
    10    }
    11  ],
    12  "createEntities": [
    13    {
    14      "client": {
    15        "id": "client0",
    16        "useMultipleMongoses": false,
    17        "observeEvents": [
    18          "commandStartedEvent"
    19        ]
    20      }
    21    },
    22    {
    23      "database": {
    24        "id": "database0",
    25        "client": "client0",
    26        "databaseName": "retryable-writes-tests"
    27      }
    28    },
    29    {
    30      "collection": {
    31        "id": "collection0",
    32        "database": "database0",
    33        "collectionName": "coll"
    34      }
    35    }
    36  ],
    37  "initialData": [
    38    {
    39      "collectionName": "coll",
    40      "databaseName": "retryable-writes-tests",
    41      "documents": [
    42        {
    43          "_id": 1,
    44          "x": 11
    45        },
    46        {
    47          "_id": 2,
    48          "x": 22
    49        }
    50      ]
    51    }
    52  ],
    53  "tests": [
    54    {
    55      "description": "InsertOne succeeds after retryable writeConcernError",
    56      "runOnRequirements": [
    57        {
    58          "minServerVersion": "4.0",
    59          "topologies": [
    60            "replicaset"
    61          ]
    62        },
    63        {
    64          "minServerVersion": "4.1.7",
    65          "topologies": [
    66            "sharded-replicaset"
    67          ]
    68        }
    69      ],
    70      "operations": [
    71        {
    72          "name": "failPoint",
    73          "object": "testRunner",
    74          "arguments": {
    75            "client": "client0",
    76            "failPoint": {
    77              "configureFailPoint": "failCommand",
    78              "mode": {
    79                "times": 1
    80              },
    81              "data": {
    82                "failCommands": [
    83                  "insert"
    84                ],
    85                "errorLabels": [
    86                  "RetryableWriteError"
    87                ],
    88                "writeConcernError": {
    89                  "code": 91,
    90                  "errmsg": "Replication is being shut down"
    91                }
    92              }
    93            }
    94          }
    95        },
    96        {
    97          "name": "insertOne",
    98          "object": "collection0",
    99          "arguments": {
   100            "document": {
   101              "_id": 3,
   102              "x": 33
   103            }
   104          },
   105          "expectResult": {
   106            "$$unsetOrMatches": {
   107              "insertedId": {
   108                "$$unsetOrMatches": 3
   109              }
   110            }
   111          }
   112        }
   113      ],
   114      "expectEvents": [
   115        {
   116          "client": "client0",
   117          "events": [
   118            {
   119              "commandStartedEvent": {
   120                "command": {
   121                  "insert": "coll",
   122                  "documents": [
   123                    {
   124                      "_id": 3,
   125                      "x": 33
   126                    }
   127                  ]
   128                },
   129                "commandName": "insert",
   130                "databaseName": "retryable-writes-tests"
   131              }
   132            },
   133            {
   134              "commandStartedEvent": {
   135                "command": {
   136                  "insert": "coll",
   137                  "documents": [
   138                    {
   139                      "_id": 3,
   140                      "x": 33
   141                    }
   142                  ]
   143                },
   144                "commandName": "insert",
   145                "databaseName": "retryable-writes-tests"
   146              }
   147            }
   148          ]
   149        }
   150      ],
   151      "outcome": [
   152        {
   153          "collectionName": "coll",
   154          "databaseName": "retryable-writes-tests",
   155          "documents": [
   156            {
   157              "_id": 1,
   158              "x": 11
   159            },
   160            {
   161              "_id": 2,
   162              "x": 22
   163            },
   164            {
   165              "_id": 3,
   166              "x": 33
   167            }
   168          ]
   169        }
   170      ]
   171    }
   172  ]
   173}

View as plain text