mongo-python-driver/test/csot/gridfs-delete.json
Shane Harvey 890cd26e1a
PYTHON-3288 Implement client side operation timeout (#954)
Add timeoutMS URI option and MongoClient keyword argument.
Add provisional/beta pymongo.timeout() api to set a deadline for a block of operations.
2022-06-06 15:36:52 -04:00

271 lines
6.1 KiB
JSON

{
"description": "timeoutMS behaves correctly for GridFS delete operations",
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.4"
}
],
"createEntities": [
{
"client": {
"id": "failPointClient",
"useMultipleMongoses": false
}
},
{
"client": {
"id": "client",
"uriOptions": {
"timeoutMS": 50
},
"useMultipleMongoses": false,
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"bucket": {
"id": "bucket",
"database": "database"
}
},
{
"collection": {
"id": "filesCollection",
"database": "database",
"collectionName": "fs.files"
}
},
{
"collection": {
"id": "chunksCollection",
"database": "database",
"collectionName": "fs.chunks"
}
}
],
"initialData": [
{
"collectionName": "fs.files",
"databaseName": "test",
"documents": [
{
"_id": {
"$oid": "000000000000000000000005"
},
"length": 10,
"chunkSize": 4,
"uploadDate": {
"$date": "1970-01-01T00:00:00.000Z"
},
"md5": "57d83cd477bfb1ccd975ab33d827a92b",
"filename": "length-10",
"contentType": "application/octet-stream",
"aliases": [],
"metadata": {}
}
]
},
{
"collectionName": "fs.chunks",
"databaseName": "test",
"documents": [
{
"_id": {
"$oid": "000000000000000000000005"
},
"files_id": {
"$oid": "000000000000000000000005"
},
"n": 0,
"data": {
"$binary": {
"base64": "ESIzRA==",
"subType": "00"
}
}
}
]
}
],
"tests": [
{
"description": "timeoutMS can be overridden for delete",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"delete"
],
"blockConnection": true,
"blockTimeMS": 55
}
}
}
},
{
"name": "delete",
"object": "bucket",
"arguments": {
"id": {
"$oid": "000000000000000000000005"
},
"timeoutMS": 100
}
}
]
},
{
"description": "timeoutMS applied to delete against the files collection",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"delete"
],
"blockConnection": true,
"blockTimeMS": 55
}
}
}
},
{
"name": "delete",
"object": "bucket",
"arguments": {
"id": {
"$oid": "000000000000000000000005"
}
},
"expectError": {
"isTimeoutError": true
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "delete",
"databaseName": "test",
"command": {
"delete": "fs.files",
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
}
]
}
]
},
{
"description": "timeoutMS applied to delete against the chunks collection",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"skip": 1
},
"data": {
"failCommands": [
"delete"
],
"blockConnection": true,
"blockTimeMS": 55
}
}
}
},
{
"name": "delete",
"object": "bucket",
"arguments": {
"id": {
"$oid": "000000000000000000000005"
}
},
"expectError": {
"isTimeoutError": true
}
}
]
},
{
"description": "timeoutMS applied to entire delete, not individual parts",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"delete"
],
"blockConnection": true,
"blockTimeMS": 30
}
}
}
},
{
"name": "delete",
"object": "bucket",
"arguments": {
"id": {
"$oid": "000000000000000000000005"
}
},
"expectError": {
"isTimeoutError": true
}
}
]
}
]
}