...
1# This test only applies to drivers that generate operationIds to enable users to link
2# together bulk writes.
3description: "operation-id"
4
5schemaVersion: "1.13"
6
7createEntities:
8 - client:
9 id: &client client
10 observeLogMessages:
11 command: debug
12 - database:
13 id: &database database
14 client: *client
15 databaseName: &databaseName logging-tests
16 - collection:
17 id: &collection collection
18 database: *database
19 collectionName: &collectionName logging-tests-collection
20
21initialData:
22 - collectionName: *collectionName
23 databaseName: *databaseName
24 documents:
25 - { _id: 1, x: 11 }
26
27tests:
28 - description: "Successful bulk write command log messages include operationIds"
29 operations:
30 - name: bulkWrite
31 object: *collection
32 arguments:
33 requests:
34 - insertOne:
35 document: { x: 1 }
36 - deleteOne:
37 filter: { x: 1 }
38
39 expectLogMessages:
40 - client: *client
41 messages:
42 - level: debug
43 component: command
44 data:
45 message: "Command started"
46 databaseName: *databaseName
47 commandName: insert
48 operationId: { $$type: [int, long] }
49
50 - level: debug
51 component: command
52 data:
53 message: "Command succeeded"
54 commandName: insert
55 operationId: { $$type: [int, long] }
56
57 - level: debug
58 component: command
59 data:
60 message: "Command started"
61 databaseName: *databaseName
62 commandName: delete
63 operationId: { $$type: [int, long] }
64
65 - level: debug
66 component: command
67 data:
68 message: "Command succeeded"
69 commandName: delete
70 operationId: { $$type: [int, long] }
71
72 - description: "Failed bulk write command log message includes operationId"
73 operations:
74 - name: bulkWrite
75 object: *collection
76 arguments:
77 requests:
78 - updateOne:
79 filter: { x: 1 }
80 update: [{ $invalidOperator: true }]
81 expectError:
82 isClientError: false
83
84 expectLogMessages:
85 - client: *client
86 messages:
87 - level: debug
88 component: command
89 data:
90 message: "Command started"
91 databaseName: *databaseName
92 commandName: update
93 operationId: { $$type: [int, long] }
94 - level: debug
95 component: command
96 data:
97 message: "Command failed"
98 commandName: update
99 operationId: { $$type: [int, long] }
View as plain text