Debian Codegraph @

testdata/unified-test-format/valid-pass/poc-retryable-writes.json

raw
1 {
2 "description": "poc-retryable-writes",
3 "schemaVersion": "1.0",
4 "runOnRequirements": [
5 {
6 "minServerVersion": "3.6",
7 "topologies": [
8 "replicaset"
9 ]
10 }
11 ],
12 "createEntities": [
13 {
14 "client": {
15 "id": "client0",
16 "useMultipleMongoses": false,
17 "observeEvents": [
18 "commandStartedEvent"
19 ]
20 }
21 },
22 {
23 "client": {
24 "id": "client1",
25 "uriOptions": {
26 "retryWrites": false
27 },
28 "useMultipleMongoses": false,
29 "observeEvents": [
30 "commandStartedEvent"
31 ]
32 }
33 },
34 {
35 "database": {
36 "id": "database0",
37 "client": "client0",
38 "databaseName": "retryable-writes-tests"
39 }
40 },
41 {
42 "database": {
43 "id": "database1",
44 "client": "client1",
45 "databaseName": "retryable-writes-tests"
46 }
47 },
48 {
49 "collection": {
50 "id": "collection0",
51 "database": "database0",
52 "collectionName": "coll"
53 }
54 },
55 {
56 "collection": {
57 "id": "collection1",
58 "database": "database1",
59 "collectionName": "coll"
60 }
61 }
62 ],
63 "initialData": [
64 {
65 "collectionName": "coll",
66 "databaseName": "retryable-writes-tests",
67 "documents": [
68 {
69 "_id": 1,
70 "x": 11
71 },
72 {
73 "_id": 2,
74 "x": 22
75 }
76 ]
77 }
78 ],
79 "tests": [
80 {
81 "description": "FindOneAndUpdate is committed on first attempt",
82 "operations": [
83 {
84 "name": "failPoint",
85 "object": "testRunner",
86 "arguments": {
87 "client": "client0",
88 "failPoint": {
89 "configureFailPoint": "onPrimaryTransactionalWrite",
90 "mode": {
91 "times": 1
92 }
93 }
94 }
95 },
96 {
97 "name": "findOneAndUpdate",
98 "object": "collection0",
99 "arguments": {
100 "filter": {
101 "_id": 1
102 },
103 "update": {
104 "$inc": {
105 "x": 1
106 }
107 },
108 "returnDocument": "Before"
109 },
110 "expectResult": {
111 "_id": 1,
112 "x": 11
113 }
114 }
115 ],
116 "outcome": [
117 {
118 "collectionName": "coll",
119 "databaseName": "retryable-writes-tests",
120 "documents": [
121 {
122 "_id": 1,
123 "x": 12
124 },
125 {
126 "_id": 2,
127 "x": 22
128 }
129 ]
130 }
131 ]
132 },
133 {
134 "description": "FindOneAndUpdate is not committed on first attempt",
135 "operations": [
136 {
137 "name": "failPoint",
138 "object": "testRunner",
139 "arguments": {
140 "client": "client0",
141 "failPoint": {
142 "configureFailPoint": "onPrimaryTransactionalWrite",
143 "mode": {
144 "times": 1
145 },
146 "data": {
147 "failBeforeCommitExceptionCode": 1
148 }
149 }
150 }
151 },
152 {
153 "name": "findOneAndUpdate",
154 "object": "collection0",
155 "arguments": {
156 "filter": {
157 "_id": 1
158 },
159 "update": {
160 "$inc": {
161 "x": 1
162 }
163 },
164 "returnDocument": "Before"
165 },
166 "expectResult": {
167 "_id": 1,
168 "x": 11
169 }
170 }
171 ],
172 "outcome": [
173 {
174 "collectionName": "coll",
175 "databaseName": "retryable-writes-tests",
176 "documents": [
177 {
178 "_id": 1,
179 "x": 12
180 },
181 {
182 "_id": 2,
183 "x": 22
184 }
185 ]
186 }
187 ]
188 },
189 {
190 "description": "FindOneAndUpdate is never committed",
191 "operations": [
192 {
193 "name": "failPoint",
194 "object": "testRunner",
195 "arguments": {
196 "client": "client0",
197 "failPoint": {
198 "configureFailPoint": "onPrimaryTransactionalWrite",
199 "mode": {
200 "times": 2
201 },
202 "data": {
203 "failBeforeCommitExceptionCode": 1
204 }
205 }
206 }
207 },
208 {
209 "name": "findOneAndUpdate",
210 "object": "collection0",
211 "arguments": {
212 "filter": {
213 "_id": 1
214 },
215 "update": {
216 "$inc": {
217 "x": 1
218 }
219 },
220 "returnDocument": "Before"
221 },
222 "expectError": {
223 "isError": true
224 }
225 }
226 ],
227 "outcome": [
228 {
229 "collectionName": "coll",
230 "databaseName": "retryable-writes-tests",
231 "documents": [
232 {
233 "_id": 1,
234 "x": 11
235 },
236 {
237 "_id": 2,
238 "x": 22
239 }
240 ]
241 }
242 ]
243 },
244 {
245 "description": "InsertMany succeeds after PrimarySteppedDown",
246 "runOnRequirements": [
247 {
248 "minServerVersion": "4.0",
249 "topologies": [
250 "replicaset"
251 ]
252 },
253 {
254 "minServerVersion": "4.1.7",
255 "topologies": [
256 "sharded-replicaset"
257 ]
258 }
259 ],
260 "operations": [
261 {
262 "name": "failPoint",
263 "object": "testRunner",
264 "arguments": {
265 "client": "client0",
266 "failPoint": {
267 "configureFailPoint": "failCommand",
268 "mode": {
269 "times": 1
270 },
271 "data": {
272 "failCommands": [
273 "insert"
274 ],
275 "errorCode": 189,
276 "errorLabels": [
277 "RetryableWriteError"
278 ]
279 }
280 }
281 }
282 },
283 {
284 "name": "insertMany",
285 "object": "collection0",
286 "arguments": {
287 "documents": [
288 {
289 "_id": 3,
290 "x": 33
291 },
292 {
293 "_id": 4,
294 "x": 44
295 }
296 ],
297 "ordered": true
298 },
299 "expectResult": {
300 "$$unsetOrMatches": {
301 "insertedIds": {
302 "$$unsetOrMatches": {
303 "0": 3,
304 "1": 4
305 }
306 }
307 }
308 }
309 }
310 ],
311 "outcome": [
312 {
313 "collectionName": "coll",
314 "databaseName": "retryable-writes-tests",
315 "documents": [
316 {
317 "_id": 1,
318 "x": 11
319 },
320 {
321 "_id": 2,
322 "x": 22
323 },
324 {
325 "_id": 3,
326 "x": 33
327 },
328 {
329 "_id": 4,
330 "x": 44
331 }
332 ]
333 }
334 ]
335 },
336 {
337 "description": "InsertOne fails after connection failure when retryWrites option is false",
338 "runOnRequirements": [
339 {
340 "minServerVersion": "4.0",
341 "topologies": [
342 "replicaset"
343 ]
344 },
345 {
346 "minServerVersion": "4.1.7",
347 "topologies": [
348 "sharded-replicaset"
349 ]
350 }
351 ],
352 "operations": [
353 {
354 "name": "failPoint",
355 "object": "testRunner",
356 "arguments": {
357 "client": "client1",
358 "failPoint": {
359 "configureFailPoint": "failCommand",
360 "mode": {
361 "times": 1
362 },
363 "data": {
364 "failCommands": [
365 "insert"
366 ],
367 "closeConnection": true
368 }
369 }
370 }
371 },
372 {
373 "name": "insertOne",
374 "object": "collection1",
375 "arguments": {
376 "document": {
377 "_id": 3,
378 "x": 33
379 }
380 },
381 "expectError": {
382 "errorLabelsOmit": [
383 "RetryableWriteError"
384 ]
385 }
386 }
387 ],
388 "outcome": [
389 {
390 "collectionName": "coll",
391 "databaseName": "retryable-writes-tests",
392 "documents": [
393 {
394 "_id": 1,
395 "x": 11
396 },
397 {
398 "_id": 2,
399 "x": 22
400 }
401 ]
402 }
403 ]
404 },
405 {
406 "description": "InsertOne fails after multiple retryable writeConcernErrors",
407 "runOnRequirements": [
408 {
409 "minServerVersion": "4.0",
410 "topologies": [
411 "replicaset"
412 ]
413 },
414 {
415 "minServerVersion": "4.1.7",
416 "topologies": [
417 "sharded-replicaset"
418 ]
419 }
420 ],
421 "operations": [
422 {
423 "name": "failPoint",
424 "object": "testRunner",
425 "arguments": {
426 "client": "client0",
427 "failPoint": {
428 "configureFailPoint": "failCommand",
429 "mode": {
430 "times": 2
431 },
432 "data": {
433 "failCommands": [
434 "insert"
435 ],
436 "writeConcernError": {
437 "code": 91,
438 "errmsg": "Replication is being shut down"
439 }
440 }
441 }
442 }
443 },
444 {
445 "name": "insertOne",
446 "object": "collection0",
447 "arguments": {
448 "document": {
449 "_id": 3,
450 "x": 33
451 }
452 },
453 "expectError": {
454 "errorLabelsContain": [
455 "RetryableWriteError"
456 ]
457 }
458 }
459 ],
460 "outcome": [
461 {
462 "collectionName": "coll",
463 "databaseName": "retryable-writes-tests",
464 "documents": [
465 {
466 "_id": 1,
467 "x": 11
468 },
469 {
470 "_id": 2,
471 "x": 22
472 },
473 {
474 "_id": 3,
475 "x": 33
476 }
477 ]
478 }
479 ]
480 }
481 ]
482 }