...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-reads/findOne.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": "FindOne succeeds on first attempt",
    45      "operations": [
    46        {
    47          "name": "findOne",
    48          "object": "collection",
    49          "arguments": {
    50            "filter": {
    51              "_id": 1
    52            }
    53          },
    54          "result": {
    55            "_id": 1,
    56            "x": 11
    57          }
    58        }
    59      ],
    60      "expectations": [
    61        {
    62          "command_started_event": {
    63            "command": {
    64              "find": "coll",
    65              "filter": {
    66                "_id": 1
    67              }
    68            },
    69            "database_name": "retryable-reads-tests"
    70          }
    71        }
    72      ]
    73    },
    74    {
    75      "description": "FindOne succeeds on second attempt",
    76      "failPoint": {
    77        "configureFailPoint": "failCommand",
    78        "mode": {
    79          "times": 1
    80        },
    81        "data": {
    82          "failCommands": [
    83            "find"
    84          ],
    85          "closeConnection": true
    86        }
    87      },
    88      "operations": [
    89        {
    90          "name": "findOne",
    91          "object": "collection",
    92          "arguments": {
    93            "filter": {
    94              "_id": 1
    95            }
    96          },
    97          "result": {
    98            "_id": 1,
    99            "x": 11
   100          }
   101        }
   102      ],
   103      "expectations": [
   104        {
   105          "command_started_event": {
   106            "command": {
   107              "find": "coll",
   108              "filter": {
   109                "_id": 1
   110              }
   111            },
   112            "database_name": "retryable-reads-tests"
   113          }
   114        },
   115        {
   116          "command_started_event": {
   117            "command": {
   118              "find": "coll",
   119              "filter": {
   120                "_id": 1
   121              }
   122            },
   123            "database_name": "retryable-reads-tests"
   124          }
   125        }
   126      ]
   127    },
   128    {
   129      "description": "FindOne fails on first attempt",
   130      "clientOptions": {
   131        "retryReads": false
   132      },
   133      "failPoint": {
   134        "configureFailPoint": "failCommand",
   135        "mode": {
   136          "times": 1
   137        },
   138        "data": {
   139          "failCommands": [
   140            "find"
   141          ],
   142          "closeConnection": true
   143        }
   144      },
   145      "operations": [
   146        {
   147          "name": "findOne",
   148          "object": "collection",
   149          "arguments": {
   150            "filter": {
   151              "_id": 1
   152            }
   153          },
   154          "error": true
   155        }
   156      ],
   157      "expectations": [
   158        {
   159          "command_started_event": {
   160            "command": {
   161              "find": "coll",
   162              "filter": {
   163                "_id": 1
   164              }
   165            },
   166            "database_name": "retryable-reads-tests"
   167          }
   168        }
   169      ]
   170    },
   171    {
   172      "description": "FindOne fails on second attempt",
   173      "failPoint": {
   174        "configureFailPoint": "failCommand",
   175        "mode": {
   176          "times": 2
   177        },
   178        "data": {
   179          "failCommands": [
   180            "find"
   181          ],
   182          "closeConnection": true
   183        }
   184      },
   185      "operations": [
   186        {
   187          "name": "findOne",
   188          "object": "collection",
   189          "arguments": {
   190            "filter": {
   191              "_id": 1
   192            }
   193          },
   194          "error": true
   195        }
   196      ],
   197      "expectations": [
   198        {
   199          "command_started_event": {
   200            "command": {
   201              "find": "coll",
   202              "filter": {
   203                "_id": 1
   204              }
   205            },
   206            "database_name": "retryable-reads-tests"
   207          }
   208        },
   209        {
   210          "command_started_event": {
   211            "command": {
   212              "find": "coll",
   213              "filter": {
   214                "_id": 1
   215              }
   216            },
   217            "database_name": "retryable-reads-tests"
   218          }
   219        }
   220      ]
   221    }
   222  ]
   223}

View as plain text