Skip to content

Commit a52b422

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

File tree

4 files changed

+235
-118
lines changed

4 files changed

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

0 commit comments

Comments
 (0)