mongo-python-driver/test/csot/legacy-timeouts.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

380 lines
9.2 KiB
JSON

{
"description": "legacy timeouts continue to work if timeoutMS is not set",
"schemaVersion": "1.9",
"runOnRequirements": [
{
"minServerVersion": "4.4"
}
],
"initialData": [
{
"collectionName": "coll",
"databaseName": "test",
"documents": []
}
],
"tests": [
{
"description": "socketTimeoutMS is not used to derive a maxTimeMS command field",
"operations": [
{
"name": "createEntities",
"object": "testRunner",
"arguments": {
"entities": [
{
"client": {
"id": "client",
"observeEvents": [
"commandStartedEvent"
],
"uriOptions": {
"socketTimeoutMS": 50000
}
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
}
]
}
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"document": {
"x": 1
}
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll",
"maxTimeMS": {
"$$exists": false
}
}
}
}
]
}
]
},
{
"description": "waitQueueTimeoutMS is not used to derive a maxTimeMS command field",
"operations": [
{
"name": "createEntities",
"object": "testRunner",
"arguments": {
"entities": [
{
"client": {
"id": "client",
"observeEvents": [
"commandStartedEvent"
],
"uriOptions": {
"waitQueueTimeoutMS": 50000
}
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
}
]
}
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"document": {
"x": 1
}
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll",
"maxTimeMS": {
"$$exists": false
}
}
}
}
]
}
]
},
{
"description": "wTimeoutMS is not used to derive a maxTimeMS command field",
"operations": [
{
"name": "createEntities",
"object": "testRunner",
"arguments": {
"entities": [
{
"client": {
"id": "client",
"observeEvents": [
"commandStartedEvent"
],
"uriOptions": {
"wTimeoutMS": 50000
}
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
}
]
}
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"document": {
"x": 1
}
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll",
"maxTimeMS": {
"$$exists": false
},
"writeConcern": {
"wtimeout": 50000
}
}
}
}
]
}
]
},
{
"description": "maxTimeMS option is used directly as the maxTimeMS field on a command",
"operations": [
{
"name": "createEntities",
"object": "testRunner",
"arguments": {
"entities": [
{
"client": {
"id": "client",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
}
]
}
},
{
"name": "estimatedDocumentCount",
"object": "collection",
"arguments": {
"maxTimeMS": 50000
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "count",
"databaseName": "test",
"command": {
"count": "coll",
"maxTimeMS": 50000
}
}
}
]
}
]
},
{
"description": "maxCommitTimeMS option is used directly as the maxTimeMS field on a commitTransaction command",
"runOnRequirements": [
{
"topologies": [
"replicaset",
"sharded-replicaset"
]
}
],
"operations": [
{
"name": "createEntities",
"object": "testRunner",
"arguments": {
"entities": [
{
"client": {
"id": "client",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "test"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "coll"
}
},
{
"session": {
"id": "session",
"client": "client",
"sessionOptions": {
"defaultTransactionOptions": {
"maxCommitTimeMS": 1000
}
}
}
}
]
}
},
{
"name": "startTransaction",
"object": "session"
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"document": {
"_id": 1
},
"session": "session"
}
},
{
"name": "commitTransaction",
"object": "session"
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"commandName": "insert",
"databaseName": "test",
"command": {
"insert": "coll",
"maxTimeMS": {
"$$exists": false
}
}
}
},
{
"commandStartedEvent": {
"commandName": "commitTransaction",
"databaseName": "admin",
"command": {
"commitTransaction": 1,
"maxTimeMS": 1000
}
}
}
]
}
]
}
]
}