Skip to content

Commit c523c1d

Browse files
committed
test: update unified tests
1 parent 9848ef7 commit c523c1d

File tree

4 files changed

+237
-118
lines changed

4 files changed

+237
-118
lines changed

test/spec/command-logging-and-monitoring/monitoring/insertOne.json

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -139,86 +139,6 @@
139139
]
140140
}
141141
]
142-
},
143-
{
144-
"description": "A failed insertOne with write concern errors publishes success event",
145-
"operations": [
146-
{
147-
"name": "failPoint",
148-
"object": "testRunner",
149-
"arguments": {
150-
"client": "client",
151-
"failPoint": {
152-
"configureFailPoint": "failCommand",
153-
"mode": {
154-
"times": 1
155-
},
156-
"data": {
157-
"failCommands": [
158-
"insert"
159-
],
160-
"writeConcernError": {
161-
"code": 91,
162-
"errorLabels": [
163-
"RetryableWriteError"
164-
]
165-
}
166-
}
167-
}
168-
}
169-
},
170-
{
171-
"name": "insertOne",
172-
"object": "collection",
173-
"arguments": {
174-
"document": {
175-
"_id": 3,
176-
"x": 33
177-
}
178-
},
179-
"expectError": {
180-
"isClientError": false
181-
}
182-
}
183-
],
184-
"expectEvents": [
185-
{
186-
"client": "client",
187-
"events": [
188-
{
189-
"commandStartedEvent": {
190-
"command": {
191-
"insert": "test",
192-
"documents": [
193-
{
194-
"_id": 3,
195-
"x": 33
196-
}
197-
],
198-
"ordered": true
199-
},
200-
"commandName": "insert",
201-
"databaseName": "command-monitoring-tests"
202-
}
203-
},
204-
{
205-
"commandSucceededEvent": {
206-
"reply": {
207-
"ok": 1,
208-
"n": 1,
209-
"writeConcernError": {
210-
"code": 91,
211-
"errorLabels": [
212-
"RetryableWriteError"
213-
]
214-
}
215-
},
216-
"commandName": "insert"
217-
}
218-
}
219-
]
220-
}
221-
]
222142
}
223143
]
224144
}

test/spec/command-logging-and-monitoring/monitoring/insertOne.yml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -75,41 +75,3 @@ tests:
7575
# so those assertions are not present here.
7676
writeErrors: { $$type: array }
7777
commandName: insert
78-
79-
- description: "A failed insertOne with write concern errors publishes success event"
80-
operations:
81-
- name: failPoint
82-
object: testRunner
83-
arguments:
84-
client: *client
85-
failPoint:
86-
configureFailPoint: failCommand
87-
mode: { times: 1 }
88-
data:
89-
failCommands: [ insert ]
90-
writeConcernError:
91-
code: 91 # ShutdownInProgress
92-
errorLabels: [RetryableWriteError]
93-
- name: insertOne
94-
object: *collection
95-
arguments:
96-
document: { _id: 3, x: 33 }
97-
expectError:
98-
isClientError: false
99-
expectEvents:
100-
- client: *client
101-
events:
102-
- commandStartedEvent:
103-
command:
104-
insert: *collectionName
105-
documents:
106-
- { _id: 3, x: 33 }
107-
ordered: true
108-
commandName: insert
109-
databaseName: *databaseName
110-
- commandSucceededEvent:
111-
reply:
112-
ok: 1
113-
n: 1
114-
writeConcernError: { code: 91, errorLabels: [ "RetryableWriteError" ] }
115-
commandName: insert
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"description": "writeConcernError",
3+
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.1.0",
7+
"topologies": [
8+
"replicaset",
9+
"sharded"
10+
],
11+
"serverless": "forbid"
12+
}
13+
],
14+
"createEntities": [
15+
{
16+
"client": {
17+
"id": "client",
18+
"observeEvents": [
19+
"commandStartedEvent",
20+
"commandSucceededEvent",
21+
"commandFailedEvent"
22+
]
23+
}
24+
},
25+
{
26+
"database": {
27+
"id": "database",
28+
"client": "client",
29+
"databaseName": "command-monitoring-tests"
30+
}
31+
},
32+
{
33+
"collection": {
34+
"id": "collection",
35+
"database": "database",
36+
"collectionName": "test"
37+
}
38+
}
39+
],
40+
"initialData": [
41+
{
42+
"collectionName": "test",
43+
"databaseName": "command-monitoring-tests",
44+
"documents": [
45+
{
46+
"_id": 1,
47+
"x": 11
48+
}
49+
]
50+
}
51+
],
52+
"tests": [
53+
{
54+
"description": "A retryable write with write concern errors publishes success event",
55+
"operations": [
56+
{
57+
"name": "failPoint",
58+
"object": "testRunner",
59+
"arguments": {
60+
"client": "client",
61+
"failPoint": {
62+
"configureFailPoint": "failCommand",
63+
"mode": {
64+
"times": 1
65+
},
66+
"data": {
67+
"failCommands": [
68+
"insert"
69+
],
70+
"writeConcernError": {
71+
"code": 91,
72+
"errorLabels": [
73+
"RetryableWriteError"
74+
]
75+
}
76+
}
77+
}
78+
}
79+
},
80+
{
81+
"name": "insertOne",
82+
"object": "collection",
83+
"arguments": {
84+
"document": {
85+
"_id": 2,
86+
"x": 22
87+
}
88+
}
89+
}
90+
],
91+
"expectEvents": [
92+
{
93+
"client": "client",
94+
"events": [
95+
{
96+
"commandStartedEvent": {
97+
"command": {
98+
"insert": "test",
99+
"documents": [
100+
{
101+
"_id": 2,
102+
"x": 22
103+
}
104+
],
105+
"ordered": true
106+
},
107+
"commandName": "insert",
108+
"databaseName": "command-monitoring-tests"
109+
}
110+
},
111+
{
112+
"commandSucceededEvent": {
113+
"reply": {
114+
"ok": 1,
115+
"n": 1,
116+
"writeConcernError": {
117+
"code": 91,
118+
"errorLabels": [
119+
"RetryableWriteError"
120+
]
121+
}
122+
},
123+
"commandName": "insert"
124+
}
125+
},
126+
{
127+
"commandStartedEvent": {
128+
"command": {
129+
"insert": "test",
130+
"documents": [
131+
{
132+
"_id": 2,
133+
"x": 22
134+
}
135+
],
136+
"ordered": true
137+
},
138+
"commandName": "insert",
139+
"databaseName": "command-monitoring-tests"
140+
}
141+
},
142+
{
143+
"commandSucceededEvent": {
144+
"reply": {
145+
"ok": 1,
146+
"n": 1
147+
},
148+
"commandName": "insert"
149+
}
150+
}
151+
]
152+
}
153+
]
154+
}
155+
]
156+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
description: "writeConcernError"
2+
schemaVersion: "1.0"
3+
runOnRequirements:
4+
-
5+
minServerVersion: 4.1.0
6+
topologies:
7+
- replicaset
8+
- sharded
9+
serverless: "forbid"
10+
11+
createEntities:
12+
- client:
13+
id: &client client
14+
observeEvents:
15+
- commandStartedEvent
16+
- commandSucceededEvent
17+
- commandFailedEvent
18+
- database:
19+
id: &database database
20+
client: *client
21+
databaseName: &databaseName command-monitoring-tests
22+
- collection:
23+
id: &collection collection
24+
database: *database
25+
collectionName: &collectionName test
26+
27+
initialData:
28+
- collectionName: *collectionName
29+
databaseName: *databaseName
30+
documents:
31+
- { _id: 1, x: 11 }
32+
33+
tests:
34+
- description: "A retryable write with write concern errors publishes success event"
35+
operations:
36+
- name: failPoint
37+
object: testRunner
38+
arguments:
39+
client: *client
40+
failPoint:
41+
configureFailPoint: failCommand
42+
mode: { times: 1 }
43+
data:
44+
failCommands: [ insert ]
45+
writeConcernError:
46+
code: 91 # ShutdownInProgress
47+
errorLabels: [RetryableWriteError]
48+
- name: insertOne
49+
object: *collection
50+
arguments:
51+
document: { _id: 2, x: 22 }
52+
expectEvents:
53+
- client: *client
54+
events:
55+
- commandStartedEvent:
56+
command:
57+
insert: *collectionName
58+
documents:
59+
- { _id: 2, x: 22 }
60+
ordered: true
61+
commandName: insert
62+
databaseName: *databaseName
63+
- commandSucceededEvent:
64+
reply:
65+
ok: 1
66+
n: 1
67+
writeConcernError: { code: 91, errorLabels: [ "RetryableWriteError" ] }
68+
commandName: insert
69+
- commandStartedEvent:
70+
command:
71+
insert: *collectionName
72+
documents:
73+
- { _id: 2, x: 22 }
74+
ordered: true
75+
commandName: insert
76+
databaseName: *databaseName
77+
- commandSucceededEvent:
78+
reply:
79+
ok: 1
80+
n: 1
81+
commandName: insert

0 commit comments

Comments
 (0)