...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-operations-timeout/gridfs-delete.json

Documentation: go.mongodb.org/mongo-driver/testdata/client-side-operations-timeout

     1{
     2  "description": "timeoutMS behaves correctly for GridFS delete operations",
     3  "schemaVersion": "1.9",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "4.4",
     7      "serverless": "forbid"
     8    }
     9  ],
    10  "createEntities": [
    11    {
    12      "client": {
    13        "id": "failPointClient",
    14        "useMultipleMongoses": false
    15      }
    16    },
    17    {
    18      "client": {
    19        "id": "client",
    20        "uriOptions": {
    21          "timeoutMS": 75
    22        },
    23        "useMultipleMongoses": false,
    24        "observeEvents": [
    25          "commandStartedEvent"
    26        ]
    27      }
    28    },
    29    {
    30      "database": {
    31        "id": "database",
    32        "client": "client",
    33        "databaseName": "test"
    34      }
    35    },
    36    {
    37      "bucket": {
    38        "id": "bucket",
    39        "database": "database"
    40      }
    41    },
    42    {
    43      "collection": {
    44        "id": "filesCollection",
    45        "database": "database",
    46        "collectionName": "fs.files"
    47      }
    48    },
    49    {
    50      "collection": {
    51        "id": "chunksCollection",
    52        "database": "database",
    53        "collectionName": "fs.chunks"
    54      }
    55    }
    56  ],
    57  "initialData": [
    58    {
    59      "collectionName": "fs.files",
    60      "databaseName": "test",
    61      "documents": [
    62        {
    63          "_id": {
    64            "$oid": "000000000000000000000005"
    65          },
    66          "length": 8,
    67          "chunkSize": 4,
    68          "uploadDate": {
    69            "$date": "1970-01-01T00:00:00.000Z"
    70          },
    71          "filename": "length-8",
    72          "contentType": "application/octet-stream",
    73          "aliases": [],
    74          "metadata": {}
    75        }
    76      ]
    77    },
    78    {
    79      "collectionName": "fs.chunks",
    80      "databaseName": "test",
    81      "documents": [
    82        {
    83          "_id": {
    84            "$oid": "000000000000000000000005"
    85          },
    86          "files_id": {
    87            "$oid": "000000000000000000000005"
    88          },
    89          "n": 0,
    90          "data": {
    91            "$binary": {
    92              "base64": "ESIzRA==",
    93              "subType": "00"
    94            }
    95          }
    96        },
    97        {
    98          "_id": {
    99            "$oid": "000000000000000000000006"
   100          },
   101          "files_id": {
   102            "$oid": "000000000000000000000005"
   103          },
   104          "n": 1,
   105          "data": {
   106            "$binary": {
   107              "base64": "ESIzRA==",
   108              "subType": "00"
   109            }
   110          }
   111        }
   112      ]
   113    }
   114  ],
   115  "tests": [
   116    {
   117      "description": "timeoutMS can be overridden for delete",
   118      "operations": [
   119        {
   120          "name": "failPoint",
   121          "object": "testRunner",
   122          "arguments": {
   123            "client": "failPointClient",
   124            "failPoint": {
   125              "configureFailPoint": "failCommand",
   126              "mode": {
   127                "times": 1
   128              },
   129              "data": {
   130                "failCommands": [
   131                  "delete"
   132                ],
   133                "blockConnection": true,
   134                "blockTimeMS": 100
   135              }
   136            }
   137          }
   138        },
   139        {
   140          "name": "delete",
   141          "object": "bucket",
   142          "arguments": {
   143            "id": {
   144              "$oid": "000000000000000000000005"
   145            },
   146            "timeoutMS": 1000
   147          }
   148        }
   149      ]
   150    },
   151    {
   152      "description": "timeoutMS applied to delete against the files collection",
   153      "operations": [
   154        {
   155          "name": "failPoint",
   156          "object": "testRunner",
   157          "arguments": {
   158            "client": "failPointClient",
   159            "failPoint": {
   160              "configureFailPoint": "failCommand",
   161              "mode": {
   162                "times": 1
   163              },
   164              "data": {
   165                "failCommands": [
   166                  "delete"
   167                ],
   168                "blockConnection": true,
   169                "blockTimeMS": 100
   170              }
   171            }
   172          }
   173        },
   174        {
   175          "name": "delete",
   176          "object": "bucket",
   177          "arguments": {
   178            "id": {
   179              "$oid": "000000000000000000000005"
   180            }
   181          },
   182          "expectError": {
   183            "isTimeoutError": true
   184          }
   185        }
   186      ],
   187      "expectEvents": [
   188        {
   189          "client": "client",
   190          "events": [
   191            {
   192              "commandStartedEvent": {
   193                "commandName": "delete",
   194                "databaseName": "test",
   195                "command": {
   196                  "delete": "fs.files",
   197                  "maxTimeMS": {
   198                    "$$type": [
   199                      "int",
   200                      "long"
   201                    ]
   202                  }
   203                }
   204              }
   205            }
   206          ]
   207        }
   208      ]
   209    },
   210    {
   211      "description": "timeoutMS applied to delete against the chunks collection",
   212      "operations": [
   213        {
   214          "name": "failPoint",
   215          "object": "testRunner",
   216          "arguments": {
   217            "client": "failPointClient",
   218            "failPoint": {
   219              "configureFailPoint": "failCommand",
   220              "mode": {
   221                "skip": 1
   222              },
   223              "data": {
   224                "failCommands": [
   225                  "delete"
   226                ],
   227                "blockConnection": true,
   228                "blockTimeMS": 100
   229              }
   230            }
   231          }
   232        },
   233        {
   234          "name": "delete",
   235          "object": "bucket",
   236          "arguments": {
   237            "id": {
   238              "$oid": "000000000000000000000005"
   239            }
   240          },
   241          "expectError": {
   242            "isTimeoutError": true
   243          }
   244        }
   245      ]
   246    },
   247    {
   248      "description": "timeoutMS applied to entire delete, not individual parts",
   249      "operations": [
   250        {
   251          "name": "failPoint",
   252          "object": "testRunner",
   253          "arguments": {
   254            "client": "failPointClient",
   255            "failPoint": {
   256              "configureFailPoint": "failCommand",
   257              "mode": {
   258                "times": 2
   259              },
   260              "data": {
   261                "failCommands": [
   262                  "delete"
   263                ],
   264                "blockConnection": true,
   265                "blockTimeMS": 50
   266              }
   267            }
   268          }
   269        },
   270        {
   271          "name": "delete",
   272          "object": "bucket",
   273          "arguments": {
   274            "id": {
   275              "$oid": "000000000000000000000005"
   276            }
   277          },
   278          "expectError": {
   279            "isTimeoutError": true
   280          }
   281        }
   282      ]
   283    }
   284  ]
   285}

View as plain text