1{
2 "description": "poc-change-streams",
3 "schemaVersion": "1.4",
4 "runOnRequirements": [
5 {
6 "serverless": "forbid"
7 }
8 ],
9 "createEntities": [
10 {
11 "client": {
12 "id": "client0",
13 "useMultipleMongoses": false,
14 "observeEvents": [
15 "commandStartedEvent"
16 ],
17 "ignoreCommandMonitoringEvents": [
18 "getMore",
19 "killCursors"
20 ]
21 }
22 },
23 {
24 "database": {
25 "id": "database0",
26 "client": "client0",
27 "databaseName": "change-stream-tests"
28 }
29 },
30 {
31 "collection": {
32 "id": "collection0",
33 "database": "database0",
34 "collectionName": "test"
35 }
36 },
37 {
38 "client": {
39 "id": "client1",
40 "useMultipleMongoses": false
41 }
42 },
43 {
44 "database": {
45 "id": "database1",
46 "client": "client1",
47 "databaseName": "change-stream-tests"
48 }
49 },
50 {
51 "database": {
52 "id": "database2",
53 "client": "client1",
54 "databaseName": "change-stream-tests-2"
55 }
56 },
57 {
58 "collection": {
59 "id": "collection1",
60 "database": "database1",
61 "collectionName": "test"
62 }
63 },
64 {
65 "collection": {
66 "id": "collection2",
67 "database": "database1",
68 "collectionName": "test2"
69 }
70 },
71 {
72 "collection": {
73 "id": "collection3",
74 "database": "database2",
75 "collectionName": "test"
76 }
77 }
78 ],
79 "initialData": [
80 {
81 "collectionName": "test",
82 "databaseName": "change-stream-tests",
83 "documents": []
84 },
85 {
86 "collectionName": "test2",
87 "databaseName": "change-stream-tests",
88 "documents": []
89 },
90 {
91 "collectionName": "test",
92 "databaseName": "change-stream-tests-2",
93 "documents": []
94 }
95 ],
96 "tests": [
97 {
98 "description": "saveResultAsEntity is optional for createChangeStream",
99 "runOnRequirements": [
100 {
101 "minServerVersion": "3.8.0",
102 "topologies": [
103 "replicaset"
104 ]
105 }
106 ],
107 "operations": [
108 {
109 "name": "createChangeStream",
110 "object": "client0",
111 "arguments": {
112 "pipeline": []
113 }
114 }
115 ],
116 "expectEvents": [
117 {
118 "client": "client0",
119 "events": [
120 {
121 "commandStartedEvent": {
122 "command": {
123 "aggregate": 1
124 },
125 "commandName": "aggregate",
126 "databaseName": "admin"
127 }
128 }
129 ]
130 }
131 ]
132 },
133 {
134 "description": "Executing a watch helper on a MongoClient results in notifications for changes to all collections in all databases in the cluster.",
135 "runOnRequirements": [
136 {
137 "minServerVersion": "3.8.0",
138 "topologies": [
139 "replicaset"
140 ]
141 }
142 ],
143 "operations": [
144 {
145 "name": "createChangeStream",
146 "object": "client0",
147 "arguments": {
148 "pipeline": []
149 },
150 "saveResultAsEntity": "changeStream0"
151 },
152 {
153 "name": "insertOne",
154 "object": "collection2",
155 "arguments": {
156 "document": {
157 "x": 1
158 }
159 }
160 },
161 {
162 "name": "insertOne",
163 "object": "collection3",
164 "arguments": {
165 "document": {
166 "y": 1
167 }
168 }
169 },
170 {
171 "name": "insertOne",
172 "object": "collection1",
173 "arguments": {
174 "document": {
175 "z": 1
176 }
177 }
178 },
179 {
180 "name": "iterateUntilDocumentOrError",
181 "object": "changeStream0",
182 "expectResult": {
183 "operationType": "insert",
184 "ns": {
185 "db": "change-stream-tests",
186 "coll": "test2"
187 },
188 "fullDocument": {
189 "_id": {
190 "$$type": "objectId"
191 },
192 "x": 1
193 }
194 }
195 },
196 {
197 "name": "iterateUntilDocumentOrError",
198 "object": "changeStream0",
199 "expectResult": {
200 "operationType": "insert",
201 "ns": {
202 "db": "change-stream-tests-2",
203 "coll": "test"
204 },
205 "fullDocument": {
206 "_id": {
207 "$$type": "objectId"
208 },
209 "y": 1
210 }
211 }
212 },
213 {
214 "name": "iterateUntilDocumentOrError",
215 "object": "changeStream0",
216 "expectResult": {
217 "operationType": "insert",
218 "ns": {
219 "db": "change-stream-tests",
220 "coll": "test"
221 },
222 "fullDocument": {
223 "_id": {
224 "$$type": "objectId"
225 },
226 "z": 1
227 }
228 }
229 }
230 ],
231 "expectEvents": [
232 {
233 "client": "client0",
234 "events": [
235 {
236 "commandStartedEvent": {
237 "command": {
238 "aggregate": 1,
239 "cursor": {},
240 "pipeline": [
241 {
242 "$changeStream": {
243 "allChangesForCluster": true,
244 "fullDocument": {
245 "$$unsetOrMatches": "default"
246 }
247 }
248 }
249 ]
250 },
251 "commandName": "aggregate",
252 "databaseName": "admin"
253 }
254 }
255 ]
256 }
257 ]
258 },
259 {
260 "description": "Test consecutive resume",
261 "runOnRequirements": [
262 {
263 "minServerVersion": "4.1.7",
264 "topologies": [
265 "replicaset"
266 ]
267 }
268 ],
269 "operations": [
270 {
271 "name": "failPoint",
272 "object": "testRunner",
273 "arguments": {
274 "client": "client0",
275 "failPoint": {
276 "configureFailPoint": "failCommand",
277 "mode": {
278 "times": 2
279 },
280 "data": {
281 "failCommands": [
282 "getMore"
283 ],
284 "closeConnection": true
285 }
286 }
287 }
288 },
289 {
290 "name": "createChangeStream",
291 "object": "collection0",
292 "arguments": {
293 "batchSize": 1,
294 "pipeline": []
295 },
296 "saveResultAsEntity": "changeStream0"
297 },
298 {
299 "name": "insertOne",
300 "object": "collection1",
301 "arguments": {
302 "document": {
303 "x": 1
304 }
305 }
306 },
307 {
308 "name": "insertOne",
309 "object": "collection1",
310 "arguments": {
311 "document": {
312 "x": 2
313 }
314 }
315 },
316 {
317 "name": "insertOne",
318 "object": "collection1",
319 "arguments": {
320 "document": {
321 "x": 3
322 }
323 }
324 },
325 {
326 "name": "iterateUntilDocumentOrError",
327 "object": "changeStream0",
328 "expectResult": {
329 "operationType": "insert",
330 "ns": {
331 "db": "change-stream-tests",
332 "coll": "test"
333 },
334 "fullDocument": {
335 "_id": {
336 "$$type": "objectId"
337 },
338 "x": 1
339 }
340 }
341 },
342 {
343 "name": "iterateUntilDocumentOrError",
344 "object": "changeStream0",
345 "expectResult": {
346 "operationType": "insert",
347 "ns": {
348 "db": "change-stream-tests",
349 "coll": "test"
350 },
351 "fullDocument": {
352 "_id": {
353 "$$type": "objectId"
354 },
355 "x": 2
356 }
357 }
358 },
359 {
360 "name": "iterateUntilDocumentOrError",
361 "object": "changeStream0",
362 "expectResult": {
363 "operationType": "insert",
364 "ns": {
365 "db": "change-stream-tests",
366 "coll": "test"
367 },
368 "fullDocument": {
369 "_id": {
370 "$$type": "objectId"
371 },
372 "x": 3
373 }
374 }
375 }
376 ],
377 "expectEvents": [
378 {
379 "client": "client0",
380 "events": [
381 {
382 "commandStartedEvent": {
383 "command": {
384 "aggregate": "test",
385 "cursor": {
386 "batchSize": 1
387 },
388 "pipeline": [
389 {
390 "$changeStream": {
391 "fullDocument": {
392 "$$unsetOrMatches": "default"
393 }
394 }
395 }
396 ]
397 },
398 "commandName": "aggregate",
399 "databaseName": "change-stream-tests"
400 }
401 },
402 {
403 "commandStartedEvent": {
404 "command": {
405 "aggregate": "test",
406 "cursor": {
407 "batchSize": 1
408 },
409 "pipeline": [
410 {
411 "$changeStream": {
412 "fullDocument": {
413 "$$unsetOrMatches": "default"
414 },
415 "resumeAfter": {
416 "$$exists": true
417 }
418 }
419 }
420 ]
421 },
422 "commandName": "aggregate",
423 "databaseName": "change-stream-tests"
424 }
425 },
426 {
427 "commandStartedEvent": {
428 "command": {
429 "aggregate": "test",
430 "cursor": {
431 "batchSize": 1
432 },
433 "pipeline": [
434 {
435 "$changeStream": {
436 "fullDocument": {
437 "$$unsetOrMatches": "default"
438 },
439 "resumeAfter": {
440 "$$exists": true
441 }
442 }
443 }
444 ]
445 },
446 "commandName": "aggregate",
447 "databaseName": "change-stream-tests"
448 }
449 }
450 ]
451 }
452 ]
453 }
454 ]
455}
View as plain text