...

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

View as plain text