mongo-python-driver/test/command_logging/operation-id.json
Noah Stapp ebb94b669e
PYTHON-3457 Easier debugging with standardized logging (#1515)
PYTHON-3458 Add command logging.
PYTHON-3459 Add server selection logging.
PYTHON-3473 Add connection pool logging.
PYTHON-4167 Add documentation and examples.

Co-authored-by: sleepyStick <itsirisho@gmail.com>
2024-02-15 11:35:08 -08:00

199 lines
4.6 KiB
JSON

{
"description": "operation-id",
"schemaVersion": "1.13",
"createEntities": [
{
"client": {
"id": "client",
"observeLogMessages": {
"command": "debug"
}
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "logging-tests"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "logging-tests-collection"
}
}
],
"initialData": [
{
"collectionName": "logging-tests-collection",
"databaseName": "logging-tests",
"documents": [
{
"_id": 1,
"x": 11
}
]
}
],
"tests": [
{
"description": "Successful bulk write command log messages include operationIds",
"operations": [
{
"name": "bulkWrite",
"object": "collection",
"arguments": {
"requests": [
{
"insertOne": {
"document": {
"x": 1
}
}
},
{
"deleteOne": {
"filter": {
"x": 1
}
}
}
]
}
}
],
"expectLogMessages": [
{
"client": "client",
"messages": [
{
"level": "debug",
"component": "command",
"data": {
"message": "Command started",
"databaseName": "logging-tests",
"commandName": "insert",
"operationId": {
"$$type": [
"int",
"long"
]
}
}
},
{
"level": "debug",
"component": "command",
"data": {
"message": "Command succeeded",
"commandName": "insert",
"operationId": {
"$$type": [
"int",
"long"
]
}
}
},
{
"level": "debug",
"component": "command",
"data": {
"message": "Command started",
"databaseName": "logging-tests",
"commandName": "delete",
"operationId": {
"$$type": [
"int",
"long"
]
}
}
},
{
"level": "debug",
"component": "command",
"data": {
"message": "Command succeeded",
"commandName": "delete",
"operationId": {
"$$type": [
"int",
"long"
]
}
}
}
]
}
]
},
{
"description": "Failed bulk write command log message includes operationId",
"operations": [
{
"name": "bulkWrite",
"object": "collection",
"arguments": {
"requests": [
{
"updateOne": {
"filter": {
"x": 1
},
"update": [
{
"$invalidOperator": true
}
]
}
}
]
},
"expectError": {
"isClientError": false
}
}
],
"expectLogMessages": [
{
"client": "client",
"messages": [
{
"level": "debug",
"component": "command",
"data": {
"message": "Command started",
"databaseName": "logging-tests",
"commandName": "update",
"operationId": {
"$$type": [
"int",
"long"
]
}
}
},
{
"level": "debug",
"component": "command",
"data": {
"message": "Command failed",
"commandName": "update",
"operationId": {
"$$type": [
"int",
"long"
]
}
}
}
]
}
]
}
]
}