...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-reads/countDocuments.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  "tests": [
    31    {
    32      "description": "CountDocuments succeeds on first attempt",
    33      "operations": [
    34        {
    35          "name": "countDocuments",
    36          "object": "collection",
    37          "arguments": {
    38            "filter": {}
    39          },
    40          "result": 2
    41        }
    42      ],
    43      "expectations": [
    44        {
    45          "command_started_event": {
    46            "command": {
    47              "aggregate": "coll",
    48              "pipeline": [
    49                {
    50                  "$match": {}
    51                },
    52                {
    53                  "$group": {
    54                    "_id": 1,
    55                    "n": {
    56                      "$sum": 1
    57                    }
    58                  }
    59                }
    60              ]
    61            },
    62            "database_name": "retryable-reads-tests"
    63          }
    64        }
    65      ]
    66    },
    67    {
    68      "description": "CountDocuments succeeds on second attempt",
    69      "failPoint": {
    70        "configureFailPoint": "failCommand",
    71        "mode": {
    72          "times": 1
    73        },
    74        "data": {
    75          "failCommands": [
    76            "aggregate"
    77          ],
    78          "closeConnection": true
    79        }
    80      },
    81      "operations": [
    82        {
    83          "name": "countDocuments",
    84          "object": "collection",
    85          "arguments": {
    86            "filter": {}
    87          },
    88          "result": 2
    89        }
    90      ],
    91      "expectations": [
    92        {
    93          "command_started_event": {
    94            "command": {
    95              "aggregate": "coll",
    96              "pipeline": [
    97                {
    98                  "$match": {}
    99                },
   100                {
   101                  "$group": {
   102                    "_id": 1,
   103                    "n": {
   104                      "$sum": 1
   105                    }
   106                  }
   107                }
   108              ]
   109            },
   110            "database_name": "retryable-reads-tests"
   111          }
   112        },
   113        {
   114          "command_started_event": {
   115            "command": {
   116              "aggregate": "coll",
   117              "pipeline": [
   118                {
   119                  "$match": {}
   120                },
   121                {
   122                  "$group": {
   123                    "_id": 1,
   124                    "n": {
   125                      "$sum": 1
   126                    }
   127                  }
   128                }
   129              ]
   130            },
   131            "database_name": "retryable-reads-tests"
   132          }
   133        }
   134      ]
   135    },
   136    {
   137      "description": "CountDocuments fails on first attempt",
   138      "clientOptions": {
   139        "retryReads": false
   140      },
   141      "failPoint": {
   142        "configureFailPoint": "failCommand",
   143        "mode": {
   144          "times": 1
   145        },
   146        "data": {
   147          "failCommands": [
   148            "aggregate"
   149          ],
   150          "closeConnection": true
   151        }
   152      },
   153      "operations": [
   154        {
   155          "name": "countDocuments",
   156          "object": "collection",
   157          "arguments": {
   158            "filter": {}
   159          },
   160          "error": true
   161        }
   162      ],
   163      "expectations": [
   164        {
   165          "command_started_event": {
   166            "command": {
   167              "aggregate": "coll",
   168              "pipeline": [
   169                {
   170                  "$match": {}
   171                },
   172                {
   173                  "$group": {
   174                    "_id": 1,
   175                    "n": {
   176                      "$sum": 1
   177                    }
   178                  }
   179                }
   180              ]
   181            },
   182            "database_name": "retryable-reads-tests"
   183          }
   184        }
   185      ]
   186    },
   187    {
   188      "description": "CountDocuments fails on second attempt",
   189      "failPoint": {
   190        "configureFailPoint": "failCommand",
   191        "mode": {
   192          "times": 2
   193        },
   194        "data": {
   195          "failCommands": [
   196            "aggregate"
   197          ],
   198          "closeConnection": true
   199        }
   200      },
   201      "operations": [
   202        {
   203          "name": "countDocuments",
   204          "object": "collection",
   205          "arguments": {
   206            "filter": {}
   207          },
   208          "error": true
   209        }
   210      ],
   211      "expectations": [
   212        {
   213          "command_started_event": {
   214            "command": {
   215              "aggregate": "coll",
   216              "pipeline": [
   217                {
   218                  "$match": {}
   219                },
   220                {
   221                  "$group": {
   222                    "_id": 1,
   223                    "n": {
   224                      "$sum": 1
   225                    }
   226                  }
   227                }
   228              ]
   229            },
   230            "database_name": "retryable-reads-tests"
   231          }
   232        },
   233        {
   234          "command_started_event": {
   235            "command": {
   236              "aggregate": "coll",
   237              "pipeline": [
   238                {
   239                  "$match": {}
   240                },
   241                {
   242                  "$group": {
   243                    "_id": 1,
   244                    "n": {
   245                      "$sum": 1
   246                    }
   247                  }
   248                }
   249              ]
   250            },
   251            "database_name": "retryable-reads-tests"
   252          }
   253        }
   254      ]
   255    }
   256  ]
   257}

View as plain text