mongo-python-driver/test/csot/tailable-non-awaitData.json

313 lines
7.3 KiB
JSON

{
"description": "timeoutMS behaves correctly for tailable non-awaitData cursors",
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.4"
}
],
"createEntities": [
{
"client": {
"id": "failPointClient",
"useMultipleMongoses": false
}
},
{
"client": {
"id": "client",
"uriOptions": {
"timeoutMS": 200
},
"useMultipleMongoses": false,
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
}
],
"initialData": [
{
"collectionName": "coll",
"databaseName": "test",
"createOptions": {
"capped": true,
"size": 500
},
"documents": [
{
"_id": 0
},
{
"_id": 1
}
]
}
],
"tests": [
{
"description": "error if timeoutMode is cursor_lifetime",
"operations": [
{
"name": "find",
"object": "collection",
"arguments": {
"filter": {},
"timeoutMode": "cursorLifetime",
"cursorType": "tailable"
},
"expectError": {
"isClientError": true
}
}
]
},
{
"description": "timeoutMS applied to find",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"find"
],
"blockConnection": true,
"blockTimeMS": 250
}
}
}
},
{
"name": "find",
"object": "collection",
"arguments": {
"filter": {},
"cursorType": "tailable"
},
"expectError": {
"isTimeoutError": true
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "find",
"databaseName": "test",
"command": {
"find": "coll",
"tailable": true,
"awaitData": {
"$$exists": false
},
"maxTimeMS": {
"$$exists": false
}
}
}
}
]
}
]
},
{
"description": "timeoutMS is refreshed for getMore - success",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 2
},
"data": {
"failCommands": [
"find",
"getMore"
],
"blockConnection": true,
"blockTimeMS": 150
}
}
}
},
{
"name": "createFindCursor",
"object": "collection",
"arguments": {
"filter": {},
"cursorType": "tailable",
"timeoutMS": 200,
"batchSize": 1
},
"saveResultAsEntity": "tailableCursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "tailableCursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "tailableCursor"
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "find",
"databaseName": "test",
"command": {
"find": "coll",
"tailable": true,
"awaitData": {
"$$exists": false
},
"maxTimeMS": {
"$$exists": false
}
}
}
},
{
"commandStartedEvent": {
"commandName": "getMore",
"databaseName": "test",
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "coll",
"maxTimeMS": {
"$$exists": false
}
}
}
}
]
}
]
},
{
"description": "timeoutMS is refreshed for getMore - failure",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"getMore"
],
"blockConnection": true,
"blockTimeMS": 250
}
}
}
},
{
"name": "createFindCursor",
"object": "collection",
"arguments": {
"filter": {},
"cursorType": "tailable",
"batchSize": 1
},
"saveResultAsEntity": "tailableCursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "tailableCursor"
},
{
"name": "iterateUntilDocumentOrError",
"object": "tailableCursor",
"expectError": {
"isTimeoutError": true
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "find",
"databaseName": "test",
"command": {
"find": "coll",
"tailable": true,
"awaitData": {
"$$exists": false
},
"maxTimeMS": {
"$$exists": false
}
}
}
},
{
"commandStartedEvent": {
"commandName": "getMore",
"databaseName": "test",
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "coll",
"maxTimeMS": {
"$$exists": false
}
}
}
}
]
}
]
}
]
}