PYTHON-4939 - Sync CSOT runCursorCommand test (#2221)
This commit is contained in:
parent
4403169821
commit
43fa11cb80
@ -568,7 +568,11 @@ class UnifiedSpecTestMixinV1(AsyncIntegrationTest):
|
||||
self.skipTest("CSOT not implemented for watch()")
|
||||
if "cursors" in class_name:
|
||||
self.skipTest("CSOT not implemented for cursors")
|
||||
if "tailable" in class_name:
|
||||
if (
|
||||
"tailable" in class_name
|
||||
or "tailable" in description
|
||||
and "non-tailable" not in description
|
||||
):
|
||||
self.skipTest("CSOT not implemented for tailable cursors")
|
||||
if "sessions" in class_name:
|
||||
self.skipTest("CSOT not implemented for sessions")
|
||||
|
||||
583
test/csot/runCursorCommand.json
Normal file
583
test/csot/runCursorCommand.json
Normal file
@ -0,0 +1,583 @@
|
||||
{
|
||||
"description": "runCursorCommand",
|
||||
"schemaVersion": "1.9",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.4"
|
||||
}
|
||||
],
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "failPointClient",
|
||||
"useMultipleMongoses": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"client": {
|
||||
"id": "commandClient",
|
||||
"useMultipleMongoses": false,
|
||||
"observeEvents": [
|
||||
"commandStartedEvent",
|
||||
"commandSucceededEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"client": {
|
||||
"id": "client",
|
||||
"useMultipleMongoses": false,
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
],
|
||||
"ignoreCommandMonitoringEvents": [
|
||||
"killCursors"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "commandDb",
|
||||
"client": "commandClient",
|
||||
"databaseName": "commandDb"
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "db",
|
||||
"client": "client",
|
||||
"databaseName": "db"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection",
|
||||
"database": "db",
|
||||
"collectionName": "collection"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "collection",
|
||||
"databaseName": "db",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
},
|
||||
{
|
||||
"_id": 5,
|
||||
"x": 55
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "errors if timeoutMode is set without timeoutMS",
|
||||
"operations": [
|
||||
{
|
||||
"name": "runCursorCommand",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"commandName": "find",
|
||||
"command": {
|
||||
"find": "collection"
|
||||
},
|
||||
"timeoutMode": "cursorLifetime"
|
||||
},
|
||||
"expectError": {
|
||||
"isClientError": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "error if timeoutMode is cursorLifetime and cursorType is tailableAwait",
|
||||
"operations": [
|
||||
{
|
||||
"name": "runCursorCommand",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"commandName": "find",
|
||||
"command": {
|
||||
"find": "collection"
|
||||
},
|
||||
"timeoutMode": "cursorLifetime",
|
||||
"cursorType": "tailableAwait"
|
||||
},
|
||||
"expectError": {
|
||||
"isClientError": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Non-tailable cursor lifetime remaining timeoutMS applied to getMore if timeoutMode is unset",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"serverless": "forbid"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "failPoint",
|
||||
"object": "testRunner",
|
||||
"arguments": {
|
||||
"client": "failPointClient",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 2
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"find",
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "runCursorCommand",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"commandName": "find",
|
||||
"timeoutMS": 100,
|
||||
"command": {
|
||||
"find": "collection",
|
||||
"batchSize": 2
|
||||
}
|
||||
},
|
||||
"expectError": {
|
||||
"isTimeoutError": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "find",
|
||||
"command": {
|
||||
"find": "collection",
|
||||
"maxTimeMS": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "getMore",
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "collection",
|
||||
"maxTimeMS": {
|
||||
"$$exists": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Non-tailable cursor iteration timeoutMS is refreshed for getMore if timeoutMode is iteration - failure",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"serverless": "forbid"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "failPoint",
|
||||
"object": "testRunner",
|
||||
"arguments": {
|
||||
"client": "failPointClient",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "runCursorCommand",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"commandName": "find",
|
||||
"command": {
|
||||
"find": "collection",
|
||||
"batchSize": 2
|
||||
},
|
||||
"timeoutMode": "iteration",
|
||||
"timeoutMS": 100,
|
||||
"batchSize": 2
|
||||
},
|
||||
"expectError": {
|
||||
"isTimeoutError": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "find",
|
||||
"databaseName": "db",
|
||||
"command": {
|
||||
"find": "collection",
|
||||
"maxTimeMS": {
|
||||
"$$exists": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "getMore",
|
||||
"databaseName": "db",
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "collection",
|
||||
"maxTimeMS": {
|
||||
"$$exists": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Tailable cursor iteration timeoutMS is refreshed for getMore - failure",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"serverless": "forbid"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "failPoint",
|
||||
"object": "testRunner",
|
||||
"arguments": {
|
||||
"client": "failPointClient",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dropCollection",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"collection": "cappedCollection"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "createCollection",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"collection": "cappedCollection",
|
||||
"capped": true,
|
||||
"size": 4096,
|
||||
"max": 3
|
||||
},
|
||||
"saveResultAsEntity": "cappedCollection"
|
||||
},
|
||||
{
|
||||
"name": "insertMany",
|
||||
"object": "cappedCollection",
|
||||
"arguments": {
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "createCommandCursor",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"commandName": "find",
|
||||
"command": {
|
||||
"find": "cappedCollection",
|
||||
"batchSize": 1,
|
||||
"tailable": true
|
||||
},
|
||||
"timeoutMode": "iteration",
|
||||
"timeoutMS": 100,
|
||||
"batchSize": 1,
|
||||
"cursorType": "tailable"
|
||||
},
|
||||
"saveResultAsEntity": "tailableCursor"
|
||||
},
|
||||
{
|
||||
"name": "iterateUntilDocumentOrError",
|
||||
"object": "tailableCursor"
|
||||
},
|
||||
{
|
||||
"name": "iterateUntilDocumentOrError",
|
||||
"object": "tailableCursor",
|
||||
"expectError": {
|
||||
"isTimeoutError": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "drop"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "create"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "insert"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "find",
|
||||
"databaseName": "db",
|
||||
"command": {
|
||||
"find": "cappedCollection",
|
||||
"tailable": true,
|
||||
"awaitData": {
|
||||
"$$exists": false
|
||||
},
|
||||
"maxTimeMS": {
|
||||
"$$exists": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "getMore",
|
||||
"databaseName": "db",
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "cappedCollection",
|
||||
"maxTimeMS": {
|
||||
"$$exists": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Tailable cursor awaitData iteration timeoutMS is refreshed for getMore - failure",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"serverless": "forbid"
|
||||
}
|
||||
],
|
||||
"operations": [
|
||||
{
|
||||
"name": "failPoint",
|
||||
"object": "testRunner",
|
||||
"arguments": {
|
||||
"client": "failPointClient",
|
||||
"failPoint": {
|
||||
"configureFailPoint": "failCommand",
|
||||
"mode": {
|
||||
"times": 1
|
||||
},
|
||||
"data": {
|
||||
"failCommands": [
|
||||
"getMore"
|
||||
],
|
||||
"blockConnection": true,
|
||||
"blockTimeMS": 60
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dropCollection",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"collection": "cappedCollection"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "createCollection",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"collection": "cappedCollection",
|
||||
"capped": true,
|
||||
"size": 4096,
|
||||
"max": 3
|
||||
},
|
||||
"saveResultAsEntity": "cappedCollection"
|
||||
},
|
||||
{
|
||||
"name": "insertMany",
|
||||
"object": "cappedCollection",
|
||||
"arguments": {
|
||||
"documents": [
|
||||
{
|
||||
"foo": "bar"
|
||||
},
|
||||
{
|
||||
"fizz": "buzz"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "createCommandCursor",
|
||||
"object": "db",
|
||||
"arguments": {
|
||||
"command": {
|
||||
"find": "cappedCollection",
|
||||
"tailable": true,
|
||||
"awaitData": true
|
||||
},
|
||||
"cursorType": "tailableAwait",
|
||||
"batchSize": 1
|
||||
},
|
||||
"saveResultAsEntity": "tailableCursor"
|
||||
},
|
||||
{
|
||||
"name": "iterateUntilDocumentOrError",
|
||||
"object": "tailableCursor"
|
||||
},
|
||||
{
|
||||
"name": "iterateUntilDocumentOrError",
|
||||
"object": "tailableCursor",
|
||||
"expectError": {
|
||||
"isTimeoutError": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "drop"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "create"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "insert"
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "find",
|
||||
"databaseName": "db",
|
||||
"command": {
|
||||
"find": "cappedCollection",
|
||||
"tailable": true,
|
||||
"awaitData": true,
|
||||
"maxTimeMS": {
|
||||
"$$exists": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"commandName": "getMore",
|
||||
"databaseName": "db",
|
||||
"command": {
|
||||
"getMore": {
|
||||
"$$type": [
|
||||
"int",
|
||||
"long"
|
||||
]
|
||||
},
|
||||
"collection": "cappedCollection"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -567,7 +567,11 @@ class UnifiedSpecTestMixinV1(IntegrationTest):
|
||||
self.skipTest("CSOT not implemented for watch()")
|
||||
if "cursors" in class_name:
|
||||
self.skipTest("CSOT not implemented for cursors")
|
||||
if "tailable" in class_name:
|
||||
if (
|
||||
"tailable" in class_name
|
||||
or "tailable" in description
|
||||
and "non-tailable" not in description
|
||||
):
|
||||
self.skipTest("CSOT not implemented for tailable cursors")
|
||||
if "sessions" in class_name:
|
||||
self.skipTest("CSOT not implemented for sessions")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user