mongo-python-driver/test/csot/sessions-inherit-timeoutMS.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

312 lines
7.1 KiB
JSON

{
"description": "sessions inherit timeoutMS from their parent MongoClient",
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.4",
"topologies": [
"replicaset",
"sharded-replicaset"
]
}
],
"createEntities": [
{
"client": {
"id": "failPointClient",
"useMultipleMongoses": false
}
},
{
"client": {
"id": "client",
"uriOptions": {
"timeoutMS": 50
},
"useMultipleMongoses": false,
"observeEvents": [
"commandStartedEvent",
"commandSucceededEvent",
"commandFailedEvent"
]
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
},
{
"session": {
"id": "session",
"client": "client"
}
}
],
"initialData": [
{
"collectionName": "coll",
"databaseName": "test",
"documents": []
}
],
"tests": [
{
"description": "timeoutMS applied to commitTransaction",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"commitTransaction"
],
"blockConnection": true,
"blockTimeMS": 60
}
}
}
},
{
"name": "startTransaction",
"object": "session"
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session",
"document": {
"_id": 1
}
}
},
{
"name": "commitTransaction",
"object": "session",
"expectError": {
"isTimeoutError": true
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll"
}
}
},
{
"commandSucceededEvent": {
"commandName": "insert"
}
},
{
"commandStartedEvent": {
"commandName": "commitTransaction",
"databaseName": "admin",
"command": {
"commitTransaction": 1,
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
},
{
"commandFailedEvent": {
"commandName": "commitTransaction"
}
}
]
}
]
},
{
"description": "timeoutMS applied to abortTransaction",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"abortTransaction"
],
"blockConnection": true,
"blockTimeMS": 60
}
}
}
},
{
"name": "startTransaction",
"object": "session"
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session",
"document": {
"_id": 1
}
}
},
{
"name": "abortTransaction",
"object": "session"
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll"
}
}
},
{
"commandSucceededEvent": {
"commandName": "insert"
}
},
{
"commandStartedEvent": {
"commandName": "abortTransaction",
"databaseName": "admin",
"command": {
"abortTransaction": 1,
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
},
{
"commandFailedEvent": {
"commandName": "abortTransaction"
}
}
]
}
]
},
{
"description": "timeoutMS applied to withTransaction",
"operations": [
{
"name": "failPoint",
"object": "testRunner",
"arguments": {
"client": "failPointClient",
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 1
},
"data": {
"failCommands": [
"insert"
],
"blockConnection": true,
"blockTimeMS": 60
}
}
}
},
{
"name": "withTransaction",
"object": "session",
"arguments": {
"callback": [
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session",
"document": {
"_id": 1
}
},
"expectError": {
"isTimeoutError": true
}
}
]
},
"expectError": {
"isTimeoutError": true
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll",
"maxTimeMS": {
"$$type": [
"int",
"long"
]
}
}
}
},
{
"commandFailedEvent": {
"commandName": "insert"
}
}
]
}
]
}
]
}