Skip to content

Commit 62987c2

Browse files
committed
CDRIVER-4806 sync tests for failCommand errorLabels reqs
Synced with mongodb/specifications#1489 No changes were needed for retryable writes prose tests. libmongoc only implements prose test 3, which already requires MongoDB 6.0+. Note: with_transaction/callback-retry.json is unrelated but was missed in CDRIVER-2975. This test currently fails and has been skipped (see: CDRIVER-4811).
1 parent 50abb26 commit 62987c2

36 files changed

+5717
-5617
lines changed
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.4",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.3.1",
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+
"errorLabels": [
70+
"RetryableWriteError"
71+
],
72+
"writeConcernError": {
73+
"code": 91
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+
"errorLabels": [
116+
"RetryableWriteError"
117+
],
118+
"writeConcernError": {
119+
"code": 91
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+
}

src/libmongoc/tests/json/retryable_writes/legacy/bulkWrite-errorLabels.json

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,175 @@
178178
]
179179
}
180180
}
181+
},
182+
{
183+
"description": "BulkWrite succeeds after PrimarySteppedDown",
184+
"failPoint": {
185+
"configureFailPoint": "failCommand",
186+
"mode": {
187+
"times": 1
188+
},
189+
"data": {
190+
"failCommands": [
191+
"update"
192+
],
193+
"errorCode": 189,
194+
"errorLabels": [
195+
"RetryableWriteError"
196+
]
197+
}
198+
},
199+
"operation": {
200+
"name": "bulkWrite",
201+
"arguments": {
202+
"requests": [
203+
{
204+
"name": "deleteOne",
205+
"arguments": {
206+
"filter": {
207+
"_id": 1
208+
}
209+
}
210+
},
211+
{
212+
"name": "insertOne",
213+
"arguments": {
214+
"document": {
215+
"_id": 3,
216+
"x": 33
217+
}
218+
}
219+
},
220+
{
221+
"name": "updateOne",
222+
"arguments": {
223+
"filter": {
224+
"_id": 2
225+
},
226+
"update": {
227+
"$inc": {
228+
"x": 1
229+
}
230+
}
231+
}
232+
}
233+
],
234+
"options": {
235+
"ordered": true
236+
}
237+
}
238+
},
239+
"outcome": {
240+
"result": {
241+
"deletedCount": 1,
242+
"insertedCount": 1,
243+
"insertedIds": {
244+
"1": 3
245+
},
246+
"matchedCount": 1,
247+
"modifiedCount": 1,
248+
"upsertedCount": 0,
249+
"upsertedIds": {}
250+
},
251+
"collection": {
252+
"data": [
253+
{
254+
"_id": 2,
255+
"x": 23
256+
},
257+
{
258+
"_id": 3,
259+
"x": 33
260+
}
261+
]
262+
}
263+
}
264+
},
265+
{
266+
"description": "BulkWrite succeeds after WriteConcernError ShutdownInProgress",
267+
"failPoint": {
268+
"configureFailPoint": "failCommand",
269+
"mode": {
270+
"times": 1
271+
},
272+
"data": {
273+
"failCommands": [
274+
"insert"
275+
],
276+
"errorLabels": [
277+
"RetryableWriteError"
278+
],
279+
"writeConcernError": {
280+
"code": 91,
281+
"errmsg": "Replication is being shut down"
282+
}
283+
}
284+
},
285+
"operation": {
286+
"name": "bulkWrite",
287+
"arguments": {
288+
"requests": [
289+
{
290+
"name": "deleteOne",
291+
"arguments": {
292+
"filter": {
293+
"_id": 1
294+
}
295+
}
296+
},
297+
{
298+
"name": "insertOne",
299+
"arguments": {
300+
"document": {
301+
"_id": 3,
302+
"x": 33
303+
}
304+
}
305+
},
306+
{
307+
"name": "updateOne",
308+
"arguments": {
309+
"filter": {
310+
"_id": 2
311+
},
312+
"update": {
313+
"$inc": {
314+
"x": 1
315+
}
316+
}
317+
}
318+
}
319+
],
320+
"options": {
321+
"ordered": true
322+
}
323+
}
324+
},
325+
"outcome": {
326+
"result": {
327+
"deletedCount": 1,
328+
"insertedCount": 1,
329+
"insertedIds": {
330+
"1": 3
331+
},
332+
"matchedCount": 1,
333+
"modifiedCount": 1,
334+
"upsertedCount": 0,
335+
"upsertedIds": {}
336+
},
337+
"collection": {
338+
"data": [
339+
{
340+
"_id": 2,
341+
"x": 23
342+
},
343+
{
344+
"_id": 3,
345+
"x": 33
346+
}
347+
]
348+
}
349+
}
181350
}
182351
]
183352
}

0 commit comments

Comments
 (0)