...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-reads/find.json

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

     1{
     2  "runOn": [
     3    {
     4      "minServerVersion": "4.0",
     5      "topology": [
     6        "single",
     7        "replicaset"
     8      ]
     9    },
    10    {
    11      "minServerVersion": "4.1.7",
    12      "topology": [
    13        "sharded",
    14        "load-balanced"
    15      ]
    16    }
    17  ],
    18  "database_name": "retryable-reads-tests",
    19  "collection_name": "coll",
    20  "data": [
    21    {
    22      "_id": 1,
    23      "x": 11
    24    },
    25    {
    26      "_id": 2,
    27      "x": 22
    28    },
    29    {
    30      "_id": 3,
    31      "x": 33
    32    },
    33    {
    34      "_id": 4,
    35      "x": 44
    36    },
    37    {
    38      "_id": 5,
    39      "x": 55
    40    }
    41  ],
    42  "tests": [
    43    {
    44      "description": "Find succeeds on first attempt",
    45      "operations": [
    46        {
    47          "name": "find",
    48          "object": "collection",
    49          "arguments": {
    50            "filter": {},
    51            "sort": {
    52              "_id": 1
    53            },
    54            "limit": 4
    55          },
    56          "result": [
    57            {
    58              "_id": 1,
    59              "x": 11
    60            },
    61            {
    62              "_id": 2,
    63              "x": 22
    64            },
    65            {
    66              "_id": 3,
    67              "x": 33
    68            },
    69            {
    70              "_id": 4,
    71              "x": 44
    72            }
    73          ]
    74        }
    75      ],
    76      "expectations": [
    77        {
    78          "command_started_event": {
    79            "command": {
    80              "find": "coll",
    81              "filter": {},
    82              "sort": {
    83                "_id": 1
    84              },
    85              "limit": 4
    86            },
    87            "database_name": "retryable-reads-tests"
    88          }
    89        }
    90      ]
    91    },
    92    {
    93      "description": "Find succeeds on second attempt with explicit clientOptions",
    94      "clientOptions": {
    95        "retryReads": true
    96      },
    97      "failPoint": {
    98        "configureFailPoint": "failCommand",
    99        "mode": {
   100          "times": 1
   101        },
   102        "data": {
   103          "failCommands": [
   104            "find"
   105          ],
   106          "closeConnection": true
   107        }
   108      },
   109      "operations": [
   110        {
   111          "name": "find",
   112          "object": "collection",
   113          "arguments": {
   114            "filter": {},
   115            "sort": {
   116              "_id": 1
   117            },
   118            "limit": 4
   119          },
   120          "result": [
   121            {
   122              "_id": 1,
   123              "x": 11
   124            },
   125            {
   126              "_id": 2,
   127              "x": 22
   128            },
   129            {
   130              "_id": 3,
   131              "x": 33
   132            },
   133            {
   134              "_id": 4,
   135              "x": 44
   136            }
   137          ]
   138        }
   139      ],
   140      "expectations": [
   141        {
   142          "command_started_event": {
   143            "command": {
   144              "find": "coll",
   145              "filter": {},
   146              "sort": {
   147                "_id": 1
   148              },
   149              "limit": 4
   150            },
   151            "database_name": "retryable-reads-tests"
   152          }
   153        },
   154        {
   155          "command_started_event": {
   156            "command": {
   157              "find": "coll",
   158              "filter": {},
   159              "sort": {
   160                "_id": 1
   161              },
   162              "limit": 4
   163            },
   164            "database_name": "retryable-reads-tests"
   165          }
   166        }
   167      ]
   168    },
   169    {
   170      "description": "Find succeeds on second attempt",
   171      "failPoint": {
   172        "configureFailPoint": "failCommand",
   173        "mode": {
   174          "times": 1
   175        },
   176        "data": {
   177          "failCommands": [
   178            "find"
   179          ],
   180          "closeConnection": true
   181        }
   182      },
   183      "operations": [
   184        {
   185          "name": "find",
   186          "object": "collection",
   187          "arguments": {
   188            "filter": {},
   189            "sort": {
   190              "_id": 1
   191            },
   192            "limit": 4
   193          },
   194          "result": [
   195            {
   196              "_id": 1,
   197              "x": 11
   198            },
   199            {
   200              "_id": 2,
   201              "x": 22
   202            },
   203            {
   204              "_id": 3,
   205              "x": 33
   206            },
   207            {
   208              "_id": 4,
   209              "x": 44
   210            }
   211          ]
   212        }
   213      ],
   214      "expectations": [
   215        {
   216          "command_started_event": {
   217            "command": {
   218              "find": "coll",
   219              "filter": {},
   220              "sort": {
   221                "_id": 1
   222              },
   223              "limit": 4
   224            },
   225            "database_name": "retryable-reads-tests"
   226          }
   227        },
   228        {
   229          "command_started_event": {
   230            "command": {
   231              "find": "coll",
   232              "filter": {},
   233              "sort": {
   234                "_id": 1
   235              },
   236              "limit": 4
   237            },
   238            "database_name": "retryable-reads-tests"
   239          }
   240        }
   241      ]
   242    },
   243    {
   244      "description": "Find fails on first attempt",
   245      "clientOptions": {
   246        "retryReads": false
   247      },
   248      "failPoint": {
   249        "configureFailPoint": "failCommand",
   250        "mode": {
   251          "times": 1
   252        },
   253        "data": {
   254          "failCommands": [
   255            "find"
   256          ],
   257          "closeConnection": true
   258        }
   259      },
   260      "operations": [
   261        {
   262          "name": "find",
   263          "object": "collection",
   264          "arguments": {
   265            "filter": {},
   266            "sort": {
   267              "_id": 1
   268            },
   269            "limit": 4
   270          },
   271          "error": true
   272        }
   273      ],
   274      "expectations": [
   275        {
   276          "command_started_event": {
   277            "command": {
   278              "find": "coll",
   279              "filter": {},
   280              "sort": {
   281                "_id": 1
   282              },
   283              "limit": 4
   284            },
   285            "database_name": "retryable-reads-tests"
   286          }
   287        }
   288      ]
   289    },
   290    {
   291      "description": "Find fails on second attempt",
   292      "failPoint": {
   293        "configureFailPoint": "failCommand",
   294        "mode": {
   295          "times": 2
   296        },
   297        "data": {
   298          "failCommands": [
   299            "find"
   300          ],
   301          "closeConnection": true
   302        }
   303      },
   304      "operations": [
   305        {
   306          "name": "find",
   307          "object": "collection",
   308          "arguments": {
   309            "filter": {},
   310            "sort": {
   311              "_id": 1
   312            },
   313            "limit": 4
   314          },
   315          "error": true
   316        }
   317      ],
   318      "expectations": [
   319        {
   320          "command_started_event": {
   321            "command": {
   322              "find": "coll",
   323              "filter": {},
   324              "sort": {
   325                "_id": 1
   326              },
   327              "limit": 4
   328            },
   329            "database_name": "retryable-reads-tests"
   330          }
   331        },
   332        {
   333          "command_started_event": {
   334            "command": {
   335              "find": "coll",
   336              "filter": {},
   337              "sort": {
   338                "_id": 1
   339              },
   340              "limit": 4
   341            },
   342            "database_name": "retryable-reads-tests"
   343          }
   344        }
   345      ]
   346    }
   347  ]
   348}

View as plain text