...

Text file src/go.mongodb.org/mongo-driver/testdata/load-balancers/sdam-error-handling.json

Documentation: go.mongodb.org/mongo-driver/testdata/load-balancers

     1{
     2  "description": "state change errors are correctly handled",
     3  "schemaVersion": "1.3",
     4  "runOnRequirements": [
     5    {
     6      "topologies": [
     7        "load-balanced"
     8      ]
     9    }
    10  ],
    11  "_yamlAnchors": {
    12    "observedEvents": [
    13      "connectionCreatedEvent",
    14      "connectionReadyEvent",
    15      "connectionCheckedOutEvent",
    16      "connectionCheckOutFailedEvent",
    17      "connectionCheckedInEvent",
    18      "connectionClosedEvent",
    19      "poolClearedEvent"
    20    ]
    21  },
    22  "createEntities": [
    23    {
    24      "client": {
    25        "id": "failPointClient",
    26        "useMultipleMongoses": false
    27      }
    28    },
    29    {
    30      "client": {
    31        "id": "singleClient",
    32        "useMultipleMongoses": false,
    33        "uriOptions": {
    34          "appname": "lbSDAMErrorTestClient",
    35          "retryWrites": false
    36        },
    37        "observeEvents": [
    38          "connectionCreatedEvent",
    39          "connectionReadyEvent",
    40          "connectionCheckedOutEvent",
    41          "connectionCheckOutFailedEvent",
    42          "connectionCheckedInEvent",
    43          "connectionClosedEvent",
    44          "poolClearedEvent"
    45        ]
    46      }
    47    },
    48    {
    49      "database": {
    50        "id": "singleDB",
    51        "client": "singleClient",
    52        "databaseName": "singleDB"
    53      }
    54    },
    55    {
    56      "collection": {
    57        "id": "singleColl",
    58        "database": "singleDB",
    59        "collectionName": "singleColl"
    60      }
    61    },
    62    {
    63      "client": {
    64        "id": "multiClient",
    65        "useMultipleMongoses": true,
    66        "uriOptions": {
    67          "retryWrites": false
    68        },
    69        "observeEvents": [
    70          "connectionCreatedEvent",
    71          "connectionReadyEvent",
    72          "connectionCheckedOutEvent",
    73          "connectionCheckOutFailedEvent",
    74          "connectionCheckedInEvent",
    75          "connectionClosedEvent",
    76          "poolClearedEvent"
    77        ]
    78      }
    79    },
    80    {
    81      "database": {
    82        "id": "multiDB",
    83        "client": "multiClient",
    84        "databaseName": "multiDB"
    85      }
    86    },
    87    {
    88      "collection": {
    89        "id": "multiColl",
    90        "database": "multiDB",
    91        "collectionName": "multiColl"
    92      }
    93    }
    94  ],
    95  "initialData": [
    96    {
    97      "collectionName": "singleColl",
    98      "databaseName": "singleDB",
    99      "documents": [
   100        {
   101          "_id": 1
   102        },
   103        {
   104          "_id": 2
   105        },
   106        {
   107          "_id": 3
   108        }
   109      ]
   110    },
   111    {
   112      "collectionName": "multiColl",
   113      "databaseName": "multiDB",
   114      "documents": [
   115        {
   116          "_id": 1
   117        },
   118        {
   119          "_id": 2
   120        },
   121        {
   122          "_id": 3
   123        }
   124      ]
   125    }
   126  ],
   127  "tests": [
   128    {
   129      "description": "only connections for a specific serviceId are closed when pools are cleared",
   130      "runOnRequirements": [
   131        {
   132          "serverless": "forbid"
   133        }
   134      ],
   135      "operations": [
   136        {
   137          "name": "createFindCursor",
   138          "object": "multiColl",
   139          "arguments": {
   140            "filter": {},
   141            "batchSize": 2
   142          },
   143          "saveResultAsEntity": "cursor0"
   144        },
   145        {
   146          "name": "createFindCursor",
   147          "object": "multiColl",
   148          "arguments": {
   149            "filter": {},
   150            "batchSize": 2
   151          },
   152          "saveResultAsEntity": "cursor1"
   153        },
   154        {
   155          "name": "close",
   156          "object": "cursor0"
   157        },
   158        {
   159          "name": "close",
   160          "object": "cursor1"
   161        },
   162        {
   163          "name": "failPoint",
   164          "object": "testRunner",
   165          "arguments": {
   166            "client": "multiClient",
   167            "failPoint": {
   168              "configureFailPoint": "failCommand",
   169              "mode": {
   170                "times": 1
   171              },
   172              "data": {
   173                "failCommands": [
   174                  "insert"
   175                ],
   176                "errorCode": 11600
   177              }
   178            }
   179          }
   180        },
   181        {
   182          "name": "insertOne",
   183          "object": "multiColl",
   184          "arguments": {
   185            "document": {
   186              "x": 1
   187            }
   188          },
   189          "expectError": {
   190            "errorCode": 11600
   191          }
   192        },
   193        {
   194          "name": "insertOne",
   195          "object": "multiColl",
   196          "arguments": {
   197            "document": {
   198              "x": 1
   199            }
   200          }
   201        }
   202      ],
   203      "expectEvents": [
   204        {
   205          "client": "multiClient",
   206          "eventType": "cmap",
   207          "events": [
   208            {
   209              "connectionCreatedEvent": {}
   210            },
   211            {
   212              "connectionReadyEvent": {}
   213            },
   214            {
   215              "connectionCheckedOutEvent": {}
   216            },
   217            {
   218              "connectionCreatedEvent": {}
   219            },
   220            {
   221              "connectionReadyEvent": {}
   222            },
   223            {
   224              "connectionCheckedOutEvent": {}
   225            },
   226            {
   227              "connectionCheckedInEvent": {}
   228            },
   229            {
   230              "connectionCheckedInEvent": {}
   231            },
   232            {
   233              "connectionCheckedOutEvent": {}
   234            },
   235            {
   236              "connectionCheckedInEvent": {}
   237            },
   238            {
   239              "connectionCheckedOutEvent": {}
   240            },
   241            {
   242              "poolClearedEvent": {}
   243            },
   244            {
   245              "connectionCheckedInEvent": {}
   246            },
   247            {
   248              "connectionClosedEvent": {
   249                "reason": "stale"
   250              }
   251            },
   252            {
   253              "connectionCheckedOutEvent": {}
   254            },
   255            {
   256              "connectionCheckedInEvent": {}
   257            }
   258          ]
   259        }
   260      ]
   261    },
   262    {
   263      "description": "errors during the initial connection hello are ignore",
   264      "runOnRequirements": [
   265        {
   266          "minServerVersion": "4.9"
   267        }
   268      ],
   269      "operations": [
   270        {
   271          "name": "failPoint",
   272          "object": "testRunner",
   273          "arguments": {
   274            "client": "failPointClient",
   275            "failPoint": {
   276              "configureFailPoint": "failCommand",
   277              "mode": {
   278                "times": 1
   279              },
   280              "data": {
   281                "failCommands": [
   282                  "isMaster",
   283                  "hello"
   284                ],
   285                "closeConnection": true,
   286                "appName": "lbSDAMErrorTestClient"
   287              }
   288            }
   289          }
   290        },
   291        {
   292          "name": "insertOne",
   293          "object": "singleColl",
   294          "arguments": {
   295            "document": {
   296              "x": 1
   297            }
   298          },
   299          "expectError": {
   300            "isClientError": true
   301          }
   302        }
   303      ],
   304      "expectEvents": [
   305        {
   306          "client": "singleClient",
   307          "eventType": "cmap",
   308          "events": [
   309            {
   310              "connectionCreatedEvent": {}
   311            },
   312            {
   313              "connectionClosedEvent": {
   314                "reason": "error"
   315              }
   316            },
   317            {
   318              "connectionCheckOutFailedEvent": {
   319                "reason": "connectionError"
   320              }
   321            }
   322          ]
   323        }
   324      ]
   325    },
   326    {
   327      "description": "errors during authentication are processed",
   328      "runOnRequirements": [
   329        {
   330          "auth": true
   331        }
   332      ],
   333      "operations": [
   334        {
   335          "name": "failPoint",
   336          "object": "testRunner",
   337          "arguments": {
   338            "client": "failPointClient",
   339            "failPoint": {
   340              "configureFailPoint": "failCommand",
   341              "mode": {
   342                "times": 1
   343              },
   344              "data": {
   345                "failCommands": [
   346                  "saslContinue"
   347                ],
   348                "closeConnection": true,
   349                "appName": "lbSDAMErrorTestClient"
   350              }
   351            }
   352          }
   353        },
   354        {
   355          "name": "insertOne",
   356          "object": "singleColl",
   357          "arguments": {
   358            "document": {
   359              "x": 1
   360            }
   361          },
   362          "expectError": {
   363            "isClientError": true
   364          }
   365        }
   366      ],
   367      "expectEvents": [
   368        {
   369          "client": "singleClient",
   370          "eventType": "cmap",
   371          "events": [
   372            {
   373              "connectionCreatedEvent": {}
   374            },
   375            {
   376              "poolClearedEvent": {}
   377            },
   378            {
   379              "connectionClosedEvent": {
   380                "reason": "error"
   381              }
   382            },
   383            {
   384              "connectionCheckOutFailedEvent": {
   385                "reason": "connectionError"
   386              }
   387            }
   388          ]
   389        }
   390      ]
   391    },
   392    {
   393      "description": "stale errors are ignored",
   394      "operations": [
   395        {
   396          "name": "failPoint",
   397          "object": "testRunner",
   398          "arguments": {
   399            "client": "failPointClient",
   400            "failPoint": {
   401              "configureFailPoint": "failCommand",
   402              "mode": {
   403                "times": 2
   404              },
   405              "data": {
   406                "failCommands": [
   407                  "getMore"
   408                ],
   409                "closeConnection": true
   410              }
   411            }
   412          }
   413        },
   414        {
   415          "name": "createFindCursor",
   416          "object": "singleColl",
   417          "arguments": {
   418            "filter": {},
   419            "batchSize": 2
   420          },
   421          "saveResultAsEntity": "cursor0"
   422        },
   423        {
   424          "name": "createFindCursor",
   425          "object": "singleColl",
   426          "arguments": {
   427            "filter": {},
   428            "batchSize": 2
   429          },
   430          "saveResultAsEntity": "cursor1"
   431        },
   432        {
   433          "name": "iterateUntilDocumentOrError",
   434          "object": "cursor0"
   435        },
   436        {
   437          "name": "iterateUntilDocumentOrError",
   438          "object": "cursor0"
   439        },
   440        {
   441          "name": "iterateUntilDocumentOrError",
   442          "object": "cursor0",
   443          "expectError": {
   444            "isClientError": true
   445          }
   446        },
   447        {
   448          "name": "close",
   449          "object": "cursor0"
   450        },
   451        {
   452          "name": "iterateUntilDocumentOrError",
   453          "object": "cursor1"
   454        },
   455        {
   456          "name": "iterateUntilDocumentOrError",
   457          "object": "cursor1"
   458        },
   459        {
   460          "name": "iterateUntilDocumentOrError",
   461          "object": "cursor1",
   462          "expectError": {
   463            "isClientError": true
   464          }
   465        },
   466        {
   467          "name": "close",
   468          "object": "cursor1"
   469        }
   470      ],
   471      "expectEvents": [
   472        {
   473          "client": "singleClient",
   474          "eventType": "cmap",
   475          "events": [
   476            {
   477              "connectionCreatedEvent": {}
   478            },
   479            {
   480              "connectionReadyEvent": {}
   481            },
   482            {
   483              "connectionCheckedOutEvent": {}
   484            },
   485            {
   486              "connectionCreatedEvent": {}
   487            },
   488            {
   489              "connectionReadyEvent": {}
   490            },
   491            {
   492              "connectionCheckedOutEvent": {}
   493            },
   494            {
   495              "poolClearedEvent": {}
   496            },
   497            {
   498              "connectionCheckedInEvent": {}
   499            },
   500            {
   501              "connectionClosedEvent": {}
   502            },
   503            {
   504              "connectionCheckedInEvent": {}
   505            },
   506            {
   507              "connectionClosedEvent": {}
   508            }
   509          ]
   510        }
   511      ]
   512    }
   513  ]
   514}

View as plain text