-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Aditi Khare <106987683+aditi-khare-mongoDB@users.noreply.github.com>
- Loading branch information
1 parent
c948d9c
commit ec3caba
Showing
8 changed files
with
298 additions
and
12 deletions.
There are no files selected for viewing
151 changes: 151 additions & 0 deletions
151
test/spec/command-logging-and-monitoring/logging/unacknowledged-write.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
{ | ||
"description": "unacknowledged-write", | ||
"schemaVersion": "1.16", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client", | ||
"useMultipleMongoses": false, | ||
"observeLogMessages": { | ||
"command": "debug" | ||
} | ||
} | ||
}, | ||
{ | ||
"database": { | ||
"id": "database", | ||
"client": "client", | ||
"databaseName": "logging-tests" | ||
} | ||
}, | ||
{ | ||
"collection": { | ||
"id": "collection", | ||
"database": "database", | ||
"collectionName": "logging-tests-collection", | ||
"collectionOptions": { | ||
"writeConcern": { | ||
"w": 0 | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"initialData": [ | ||
{ | ||
"collectionName": "logging-tests-collection", | ||
"databaseName": "logging-tests", | ||
"documents": [ | ||
{ | ||
"_id": 1 | ||
} | ||
] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "An unacknowledged write generates a succeeded log message with ok: 1 reply", | ||
"operations": [ | ||
{ | ||
"name": "insertOne", | ||
"object": "collection", | ||
"arguments": { | ||
"document": { | ||
"_id": 2 | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "find", | ||
"object": "collection", | ||
"arguments": { | ||
"filter": {} | ||
}, | ||
"expectResult": [ | ||
{ | ||
"_id": 1 | ||
}, | ||
{ | ||
"_id": 2 | ||
} | ||
] | ||
} | ||
], | ||
"expectLogMessages": [ | ||
{ | ||
"client": "client", | ||
"ignoreExtraMessages": true, | ||
"messages": [ | ||
{ | ||
"level": "debug", | ||
"component": "command", | ||
"data": { | ||
"message": "Command started", | ||
"databaseName": "logging-tests", | ||
"commandName": "insert", | ||
"command": { | ||
"$$matchAsDocument": { | ||
"$$matchAsRoot": { | ||
"insert": "logging-tests-collection", | ||
"$db": "logging-tests" | ||
} | ||
} | ||
}, | ||
"requestId": { | ||
"$$type": [ | ||
"int", | ||
"long" | ||
] | ||
}, | ||
"serverHost": { | ||
"$$type": "string" | ||
}, | ||
"serverPort": { | ||
"$$type": [ | ||
"int", | ||
"long" | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"level": "debug", | ||
"component": "command", | ||
"data": { | ||
"message": "Command succeeded", | ||
"commandName": "insert", | ||
"reply": { | ||
"$$matchAsDocument": { | ||
"ok": 1 | ||
} | ||
}, | ||
"requestId": { | ||
"$$type": [ | ||
"int", | ||
"long" | ||
] | ||
}, | ||
"serverHost": { | ||
"$$type": "string" | ||
}, | ||
"serverPort": { | ||
"$$type": [ | ||
"int", | ||
"long" | ||
] | ||
}, | ||
"durationMS": { | ||
"$$type": [ | ||
"double", | ||
"int", | ||
"long" | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
76 changes: 76 additions & 0 deletions
76
test/spec/command-logging-and-monitoring/logging/unacknowledged-write.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
description: "unacknowledged-write" | ||
|
||
schemaVersion: "1.16" | ||
|
||
createEntities: | ||
- client: | ||
id: &client client | ||
useMultipleMongoses: false | ||
observeLogMessages: | ||
command: debug | ||
- database: | ||
id: &database database | ||
client: *client | ||
databaseName: &databaseName logging-tests | ||
- collection: | ||
id: &collection collection | ||
database: *database | ||
collectionName: &collectionName logging-tests-collection | ||
collectionOptions: | ||
writeConcern: { w: 0 } | ||
|
||
initialData: | ||
- collectionName: *collectionName | ||
databaseName: *databaseName | ||
documents: | ||
- { _id: 1 } | ||
|
||
tests: | ||
- description: "An unacknowledged write generates a succeeded log message with ok: 1 reply" | ||
operations: | ||
- name: insertOne | ||
object: *collection | ||
arguments: | ||
document: { _id: 2 } | ||
# Force completion of the w: 0 write by executing a find on the same connection | ||
- name: find | ||
object: *collection | ||
arguments: | ||
filter: { } | ||
expectResult: [ | ||
{ _id: 1 }, | ||
{ _id: 2 } | ||
] | ||
expectLogMessages: | ||
- client: *client | ||
ignoreExtraMessages: true | ||
messages: | ||
- level: debug | ||
component: command | ||
data: | ||
message: "Command started" | ||
databaseName: *databaseName | ||
commandName: insert | ||
command: | ||
$$matchAsDocument: | ||
$$matchAsRoot: | ||
insert: *collectionName | ||
$db: *databaseName | ||
requestId: { $$type: [int, long] } | ||
serverHost: { $$type: string } | ||
serverPort: { $$type: [int, long] } | ||
|
||
- level: debug | ||
component: command | ||
data: | ||
message: "Command succeeded" | ||
commandName: insert | ||
reply: | ||
$$matchAsDocument: | ||
ok: 1 | ||
requestId: { $$type: [int, long] } | ||
serverHost: { $$type: string } | ||
serverPort: { $$type: [int, long] } | ||
durationMS: { $$type: [double, int, long] } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.