mongo-python-driver/test/csot/close-cursors.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

240 lines
5.3 KiB
JSON

{
"description": "timeoutMS behaves correctly when closing cursors",
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.4"
}
],
"createEntities": [
{
"client": {
"id": "failPointClient",
"useMultipleMongoses": false
}
},
{
"client": {
"id": "client",
"useMultipleMongoses": false,
"observeEvents": [
"commandStartedEvent",
"commandSucceededEvent",
"commandFailedEvent"
]
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
}
],
"initialData": [
{
"collectionName": "coll",
"databaseName": "test",
"documents": [
{
"_id": 0
},
{
"_id": 1
},
{
"_id": 2
}
]
}
],
"tests": [
{
"description": "timeoutMS is refreshed for close",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"getMore"
],
"blockConnection": true,
"blockTimeMS": 50
}
}
}
},
{
"name": "createFindCursor",
"object": "collection",
"arguments": {
"filter": {},
"batchSize": 2,
"timeoutMS": 20
},
"saveResultAsEntity": "cursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "cursor",
"expectError": {
"isTimeoutError": true
}
},
{
"name": "close",
"object": "cursor"
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "find"
}
},
{
"commandSucceededEvent": {
"commandName": "find"
}
},
{
"commandStartedEvent": {
"commandName": "getMore"
}
},
{
"commandFailedEvent": {
"commandName": "getMore"
}
},
{
"commandStartedEvent": {
"command": {
"killCursors": "coll",
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
},
"commandName": "killCursors"
}
},
{
"commandSucceededEvent": {
"commandName": "killCursors"
}
}
]
}
]
},
{
"description": "timeoutMS can be overridden for close",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "client",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"killCursors"
],
"blockConnection": true,
"blockTimeMS": 30
}
}
}
},
{
"name": "createFindCursor",
"object": "collection",
"arguments": {
"filter": {},
"batchSize": 2,
"timeoutMS": 20
},
"saveResultAsEntity": "cursor"
},
{
"name": "close",
"object": "cursor",
"arguments": {
"timeoutMS": 40
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "find"
}
},
{
"commandSucceededEvent": {
"commandName": "find"
}
},
{
"commandStartedEvent": {
"command": {
"killCursors": "collection",
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
},
"commandName": "killCursors"
}
},
{
"commandSucceededEvent": {
"commandName": "killCursors"
}
}
]
}
]
}
]
}