bson/testdata/command-monitoring/logging/driver-connection-id.json
2025-03-17 20:58:26 +01:00

147 lines
3.2 KiB
JSON

{
"description": "driver-connection-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": "A successful command",
"operations": [
{
"name": "runCommand",
"object": "database",
"arguments": {
"command": {
"ping": 1
},
"commandName": "ping"
}
}
],
"expectLogMessages": [
{
"client": "client",
"messages": [
{
"level": "debug",
"component": "command",
"data": {
"message": "Command started",
"databaseName": "logging-tests",
"commandName": "ping",
"driverConnectionId": {
"$$type": [
"int",
"long"
]
}
}
},
{
"level": "debug",
"component": "command",
"data": {
"message": "Command succeeded",
"commandName": "ping",
"driverConnectionId": {
"$$type": [
"int",
"long"
]
}
}
}
]
}
]
},
{
"description": "A failed command",
"operations": [
{
"name": "find",
"object": "collection",
"arguments": {
"filter": {
"$or": true
}
},
"expectError": {
"isClientError": false
}
}
],
"expectLogMessages": [
{
"client": "client",
"messages": [
{
"level": "debug",
"component": "command",
"data": {
"message": "Command started",
"databaseName": "logging-tests",
"commandName": "find",
"driverConnectionId": {
"$$type": [
"int",
"long"
]
}
}
},
{
"level": "debug",
"component": "command",
"data": {
"message": "Command failed",
"commandName": "find",
"driverConnectionId": {
"$$type": [
"int",
"long"
]
}
}
}
]
}
]
}
]
}