...

Text file src/go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass/poc-retryable-reads.json

Documentation: go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass

     1{
     2  "description": "poc-retryable-reads",
     3  "schemaVersion": "1.0",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "4.0",
     7      "topologies": [
     8        "single",
     9        "replicaset"
    10      ]
    11    },
    12    {
    13      "minServerVersion": "4.1.7",
    14      "topologies": [
    15        "sharded"
    16      ]
    17    }
    18  ],
    19  "createEntities": [
    20    {
    21      "client": {
    22        "id": "client0",
    23        "useMultipleMongoses": false,
    24        "observeEvents": [
    25          "commandStartedEvent"
    26        ]
    27      }
    28    },
    29    {
    30      "client": {
    31        "id": "client1",
    32        "uriOptions": {
    33          "retryReads": false
    34        },
    35        "useMultipleMongoses": false,
    36        "observeEvents": [
    37          "commandStartedEvent"
    38        ]
    39      }
    40    },
    41    {
    42      "database": {
    43        "id": "database0",
    44        "client": "client0",
    45        "databaseName": "retryable-reads-tests"
    46      }
    47    },
    48    {
    49      "database": {
    50        "id": "database1",
    51        "client": "client1",
    52        "databaseName": "retryable-reads-tests"
    53      }
    54    },
    55    {
    56      "collection": {
    57        "id": "collection0",
    58        "database": "database0",
    59        "collectionName": "coll"
    60      }
    61    },
    62    {
    63      "collection": {
    64        "id": "collection1",
    65        "database": "database1",
    66        "collectionName": "coll"
    67      }
    68    }
    69  ],
    70  "initialData": [
    71    {
    72      "collectionName": "coll",
    73      "databaseName": "retryable-reads-tests",
    74      "documents": [
    75        {
    76          "_id": 1,
    77          "x": 11
    78        },
    79        {
    80          "_id": 2,
    81          "x": 22
    82        },
    83        {
    84          "_id": 3,
    85          "x": 33
    86        }
    87      ]
    88    }
    89  ],
    90  "tests": [
    91    {
    92      "description": "Aggregate succeeds after InterruptedAtShutdown",
    93      "operations": [
    94        {
    95          "name": "failPoint",
    96          "object": "testRunner",
    97          "arguments": {
    98            "client": "client0",
    99            "failPoint": {
   100              "configureFailPoint": "failCommand",
   101              "mode": {
   102                "times": 1
   103              },
   104              "data": {
   105                "failCommands": [
   106                  "aggregate"
   107                ],
   108                "errorCode": 11600
   109              }
   110            }
   111          }
   112        },
   113        {
   114          "name": "aggregate",
   115          "object": "collection0",
   116          "arguments": {
   117            "pipeline": [
   118              {
   119                "$match": {
   120                  "_id": {
   121                    "$gt": 1
   122                  }
   123                }
   124              },
   125              {
   126                "$sort": {
   127                  "x": 1
   128                }
   129              }
   130            ]
   131          },
   132          "expectResult": [
   133            {
   134              "_id": 2,
   135              "x": 22
   136            },
   137            {
   138              "_id": 3,
   139              "x": 33
   140            }
   141          ]
   142        }
   143      ],
   144      "expectEvents": [
   145        {
   146          "client": "client0",
   147          "events": [
   148            {
   149              "commandStartedEvent": {
   150                "command": {
   151                  "aggregate": "coll",
   152                  "pipeline": [
   153                    {
   154                      "$match": {
   155                        "_id": {
   156                          "$gt": 1
   157                        }
   158                      }
   159                    },
   160                    {
   161                      "$sort": {
   162                        "x": 1
   163                      }
   164                    }
   165                  ]
   166                },
   167                "databaseName": "retryable-reads-tests"
   168              }
   169            },
   170            {
   171              "commandStartedEvent": {
   172                "command": {
   173                  "aggregate": "coll",
   174                  "pipeline": [
   175                    {
   176                      "$match": {
   177                        "_id": {
   178                          "$gt": 1
   179                        }
   180                      }
   181                    },
   182                    {
   183                      "$sort": {
   184                        "x": 1
   185                      }
   186                    }
   187                  ]
   188                },
   189                "databaseName": "retryable-reads-tests"
   190              }
   191            }
   192          ]
   193        }
   194      ]
   195    },
   196    {
   197      "description": "Find succeeds on second attempt",
   198      "operations": [
   199        {
   200          "name": "failPoint",
   201          "object": "testRunner",
   202          "arguments": {
   203            "client": "client0",
   204            "failPoint": {
   205              "configureFailPoint": "failCommand",
   206              "mode": {
   207                "times": 1
   208              },
   209              "data": {
   210                "failCommands": [
   211                  "find"
   212                ],
   213                "closeConnection": true
   214              }
   215            }
   216          }
   217        },
   218        {
   219          "name": "find",
   220          "object": "collection0",
   221          "arguments": {
   222            "filter": {},
   223            "sort": {
   224              "_id": 1
   225            },
   226            "limit": 2
   227          },
   228          "expectResult": [
   229            {
   230              "_id": 1,
   231              "x": 11
   232            },
   233            {
   234              "_id": 2,
   235              "x": 22
   236            }
   237          ]
   238        }
   239      ],
   240      "expectEvents": [
   241        {
   242          "client": "client0",
   243          "events": [
   244            {
   245              "commandStartedEvent": {
   246                "command": {
   247                  "find": "coll",
   248                  "filter": {},
   249                  "sort": {
   250                    "_id": 1
   251                  },
   252                  "limit": 2
   253                },
   254                "databaseName": "retryable-reads-tests"
   255              }
   256            },
   257            {
   258              "commandStartedEvent": {
   259                "command": {
   260                  "find": "coll",
   261                  "filter": {},
   262                  "sort": {
   263                    "_id": 1
   264                  },
   265                  "limit": 2
   266                },
   267                "databaseName": "retryable-reads-tests"
   268              }
   269            }
   270          ]
   271        }
   272      ]
   273    },
   274    {
   275      "description": "Find fails on first attempt",
   276      "operations": [
   277        {
   278          "name": "failPoint",
   279          "object": "testRunner",
   280          "arguments": {
   281            "client": "client0",
   282            "failPoint": {
   283              "configureFailPoint": "failCommand",
   284              "mode": {
   285                "times": 1
   286              },
   287              "data": {
   288                "failCommands": [
   289                  "find"
   290                ],
   291                "closeConnection": true
   292              }
   293            }
   294          }
   295        },
   296        {
   297          "name": "find",
   298          "object": "collection1",
   299          "arguments": {
   300            "filter": {}
   301          },
   302          "expectError": {
   303            "isError": true
   304          }
   305        }
   306      ],
   307      "expectEvents": [
   308        {
   309          "client": "client1",
   310          "events": [
   311            {
   312              "commandStartedEvent": {
   313                "command": {
   314                  "find": "coll",
   315                  "filter": {}
   316                },
   317                "databaseName": "retryable-reads-tests"
   318              }
   319            }
   320          ]
   321        }
   322      ]
   323    },
   324    {
   325      "description": "Find fails on second attempt",
   326      "operations": [
   327        {
   328          "name": "failPoint",
   329          "object": "testRunner",
   330          "arguments": {
   331            "client": "client0",
   332            "failPoint": {
   333              "configureFailPoint": "failCommand",
   334              "mode": {
   335                "times": 2
   336              },
   337              "data": {
   338                "failCommands": [
   339                  "find"
   340                ],
   341                "closeConnection": true
   342              }
   343            }
   344          }
   345        },
   346        {
   347          "name": "find",
   348          "object": "collection0",
   349          "arguments": {
   350            "filter": {}
   351          },
   352          "expectError": {
   353            "isError": true
   354          }
   355        }
   356      ],
   357      "expectEvents": [
   358        {
   359          "client": "client0",
   360          "events": [
   361            {
   362              "commandStartedEvent": {
   363                "command": {
   364                  "find": "coll",
   365                  "filter": {}
   366                },
   367                "databaseName": "retryable-reads-tests"
   368              }
   369            },
   370            {
   371              "commandStartedEvent": {
   372                "command": {
   373                  "find": "coll",
   374                  "filter": {}
   375                },
   376                "databaseName": "retryable-reads-tests"
   377              }
   378            }
   379          ]
   380        }
   381      ]
   382    },
   383    {
   384      "description": "ListDatabases succeeds on second attempt",
   385      "operations": [
   386        {
   387          "name": "failPoint",
   388          "object": "testRunner",
   389          "arguments": {
   390            "client": "client0",
   391            "failPoint": {
   392              "configureFailPoint": "failCommand",
   393              "mode": {
   394                "times": 1
   395              },
   396              "data": {
   397                "failCommands": [
   398                  "listDatabases"
   399                ],
   400                "closeConnection": true
   401              }
   402            }
   403          }
   404        },
   405        {
   406          "name": "listDatabases",
   407          "object": "client0"
   408        }
   409      ],
   410      "expectEvents": [
   411        {
   412          "client": "client0",
   413          "events": [
   414            {
   415              "commandStartedEvent": {
   416                "command": {
   417                  "listDatabases": 1
   418                }
   419              }
   420            },
   421            {
   422              "commandStartedEvent": {
   423                "command": {
   424                  "listDatabases": 1
   425                }
   426              }
   427            }
   428          ]
   429        }
   430      ]
   431    }
   432  ]
   433}

View as plain text