...

Text file src/go.mongodb.org/mongo-driver/testdata/change-streams/change-streams-errors.json

Documentation: go.mongodb.org/mongo-driver/testdata/change-streams

     1{
     2  "description": "change-streams-errors",
     3  "schemaVersion": "1.7",
     4  "runOnRequirements": [
     5    {
     6      "serverless": "forbid"
     7    }
     8  ],
     9  "createEntities": [
    10    {
    11      "client": {
    12        "id": "client0",
    13        "observeEvents": [
    14          "commandStartedEvent"
    15        ],
    16        "ignoreCommandMonitoringEvents": [
    17          "killCursors"
    18        ],
    19        "useMultipleMongoses": false
    20      }
    21    },
    22    {
    23      "client": {
    24        "id": "globalClient",
    25        "useMultipleMongoses": false
    26      }
    27    },
    28    {
    29      "database": {
    30        "id": "database0",
    31        "client": "client0",
    32        "databaseName": "database0"
    33      }
    34    },
    35    {
    36      "collection": {
    37        "id": "collection0",
    38        "database": "database0",
    39        "collectionName": "collection0"
    40      }
    41    },
    42    {
    43      "database": {
    44        "id": "globalDatabase0",
    45        "client": "globalClient",
    46        "databaseName": "database0"
    47      }
    48    },
    49    {
    50      "collection": {
    51        "id": "globalCollection0",
    52        "database": "globalDatabase0",
    53        "collectionName": "collection0"
    54      }
    55    }
    56  ],
    57  "initialData": [
    58    {
    59      "collectionName": "collection0",
    60      "databaseName": "database0",
    61      "documents": []
    62    }
    63  ],
    64  "tests": [
    65    {
    66      "description": "The watch helper must not throw a custom exception when executed against a single server topology, but instead depend on a server error",
    67      "runOnRequirements": [
    68        {
    69          "minServerVersion": "3.6.0",
    70          "topologies": [
    71            "single"
    72          ]
    73        }
    74      ],
    75      "operations": [
    76        {
    77          "name": "createChangeStream",
    78          "object": "collection0",
    79          "arguments": {
    80            "pipeline": []
    81          },
    82          "expectError": {
    83            "errorCode": 40573
    84          }
    85        }
    86      ]
    87    },
    88    {
    89      "description": "Change Stream should error when an invalid aggregation stage is passed in",
    90      "runOnRequirements": [
    91        {
    92          "minServerVersion": "3.6.0",
    93          "topologies": [
    94            "replicaset"
    95          ]
    96        }
    97      ],
    98      "operations": [
    99        {
   100          "name": "createChangeStream",
   101          "object": "collection0",
   102          "arguments": {
   103            "pipeline": [
   104              {
   105                "$unsupported": "foo"
   106              }
   107            ]
   108          },
   109          "expectError": {
   110            "errorCode": 40324
   111          }
   112        }
   113      ],
   114      "expectEvents": [
   115        {
   116          "client": "client0",
   117          "ignoreExtraEvents": true,
   118          "events": [
   119            {
   120              "commandStartedEvent": {
   121                "command": {
   122                  "aggregate": "collection0",
   123                  "cursor": {},
   124                  "pipeline": [
   125                    {
   126                      "$changeStream": {}
   127                    },
   128                    {
   129                      "$unsupported": "foo"
   130                    }
   131                  ]
   132                },
   133                "commandName": "aggregate",
   134                "databaseName": "database0"
   135              }
   136            }
   137          ]
   138        }
   139      ]
   140    },
   141    {
   142      "description": "Change Stream should error when _id is projected out",
   143      "runOnRequirements": [
   144        {
   145          "minServerVersion": "4.1.11",
   146          "topologies": [
   147            "replicaset",
   148            "sharded-replicaset",
   149            "load-balanced"
   150          ]
   151        }
   152      ],
   153      "operations": [
   154        {
   155          "name": "createChangeStream",
   156          "object": "collection0",
   157          "arguments": {
   158            "pipeline": [
   159              {
   160                "$project": {
   161                  "_id": 0
   162                }
   163              }
   164            ]
   165          },
   166          "saveResultAsEntity": "changeStream0"
   167        },
   168        {
   169          "name": "insertOne",
   170          "object": "globalCollection0",
   171          "arguments": {
   172            "document": {
   173              "z": 3
   174            }
   175          }
   176        },
   177        {
   178          "name": "iterateUntilDocumentOrError",
   179          "object": "changeStream0",
   180          "expectError": {
   181            "errorCode": 280
   182          }
   183        }
   184      ]
   185    },
   186    {
   187      "description": "change stream errors on ElectionInProgress",
   188      "runOnRequirements": [
   189        {
   190          "minServerVersion": "4.2",
   191          "topologies": [
   192            "replicaset",
   193            "sharded-replicaset",
   194            "load-balanced"
   195          ]
   196        }
   197      ],
   198      "operations": [
   199        {
   200          "name": "failPoint",
   201          "object": "testRunner",
   202          "arguments": {
   203            "client": "globalClient",
   204            "failPoint": {
   205              "configureFailPoint": "failCommand",
   206              "mode": {
   207                "times": 1
   208              },
   209              "data": {
   210                "failCommands": [
   211                  "getMore"
   212                ],
   213                "errorCode": 216,
   214                "closeConnection": false
   215              }
   216            }
   217          }
   218        },
   219        {
   220          "name": "createChangeStream",
   221          "object": "collection0",
   222          "arguments": {
   223            "pipeline": []
   224          },
   225          "saveResultAsEntity": "changeStream0"
   226        },
   227        {
   228          "name": "insertOne",
   229          "object": "globalCollection0",
   230          "arguments": {
   231            "document": {
   232              "z": 3
   233            }
   234          }
   235        },
   236        {
   237          "name": "iterateUntilDocumentOrError",
   238          "object": "changeStream0",
   239          "expectError": {
   240            "errorCode": 216
   241          }
   242        }
   243      ]
   244    }
   245  ]
   246}

View as plain text