Skip to content

Commit 7c228ce

Browse files
GODRIVER-2199 Add support for the comment field to all helpers (#922)
Co-authored-by: Matt Dale <[email protected]> Co-authored-by: Matt Dale <[email protected]>
1 parent 5882f3b commit 7c228ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+6702
-13
lines changed

data/change-streams/unified/change-streams.json

Lines changed: 321 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
{
22
"description": "change-streams",
33
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"topologies": [
7+
"replicaset",
8+
"sharded-replicaset"
9+
]
10+
}
11+
],
412
"createEntities": [
513
{
614
"client": {
7-
"id": "client0"
15+
"id": "client0",
16+
"observeEvents": [
17+
"commandStartedEvent"
18+
]
819
}
920
},
1021
{
@@ -34,10 +45,7 @@
3445
"description": "Test array truncation",
3546
"runOnRequirements": [
3647
{
37-
"minServerVersion": "4.7",
38-
"topologies": [
39-
"replicaset"
40-
]
48+
"minServerVersion": "4.7"
4149
}
4250
],
4351
"operations": [
@@ -111,6 +119,314 @@
111119
}
112120
}
113121
]
122+
},
123+
{
124+
"description": "Test with document comment",
125+
"runOnRequirements": [
126+
{
127+
"minServerVersion": "4.4"
128+
}
129+
],
130+
"operations": [
131+
{
132+
"name": "createChangeStream",
133+
"object": "collection0",
134+
"arguments": {
135+
"pipeline": [],
136+
"comment": {
137+
"name": "test1"
138+
}
139+
},
140+
"saveResultAsEntity": "changeStream0"
141+
}
142+
],
143+
"expectEvents": [
144+
{
145+
"client": "client0",
146+
"events": [
147+
{
148+
"commandStartedEvent": {
149+
"command": {
150+
"aggregate": "collection0",
151+
"pipeline": [
152+
{
153+
"$changeStream": {}
154+
}
155+
],
156+
"comment": {
157+
"name": "test1"
158+
}
159+
}
160+
}
161+
}
162+
]
163+
}
164+
]
165+
},
166+
{
167+
"description": "Test with document comment - pre 4.4",
168+
"skipReason": "TODO(GODRIVER-2386): aggregate only supports string comments",
169+
"runOnRequirements": [
170+
{
171+
"minServerVersion": "3.6.0",
172+
"maxServerVersion": "4.2.99"
173+
}
174+
],
175+
"operations": [
176+
{
177+
"name": "createChangeStream",
178+
"object": "collection0",
179+
"arguments": {
180+
"pipeline": [],
181+
"comment": {
182+
"name": "test1"
183+
}
184+
},
185+
"expectError": {
186+
"isClientError": false
187+
}
188+
}
189+
],
190+
"expectEvents": [
191+
{
192+
"client": "client0",
193+
"events": [
194+
{
195+
"commandStartedEvent": {
196+
"command": {
197+
"aggregate": "collection0",
198+
"pipeline": [
199+
{
200+
"$changeStream": {}
201+
}
202+
],
203+
"comment": {
204+
"name": "test1"
205+
}
206+
}
207+
}
208+
}
209+
]
210+
}
211+
]
212+
},
213+
{
214+
"description": "Test with string comment",
215+
"runOnRequirements": [
216+
{
217+
"minServerVersion": "3.6.0"
218+
}
219+
],
220+
"operations": [
221+
{
222+
"name": "createChangeStream",
223+
"object": "collection0",
224+
"arguments": {
225+
"pipeline": [],
226+
"comment": "comment"
227+
},
228+
"saveResultAsEntity": "changeStream0"
229+
}
230+
],
231+
"expectEvents": [
232+
{
233+
"client": "client0",
234+
"events": [
235+
{
236+
"commandStartedEvent": {
237+
"command": {
238+
"aggregate": "collection0",
239+
"pipeline": [
240+
{
241+
"$changeStream": {}
242+
}
243+
],
244+
"comment": "comment"
245+
}
246+
}
247+
}
248+
]
249+
}
250+
]
251+
},
252+
{
253+
"description": "Test that comment is set on getMore",
254+
"runOnRequirements": [
255+
{
256+
"minServerVersion": "4.4.0",
257+
"topologies": [
258+
"replicaset"
259+
]
260+
}
261+
],
262+
"operations": [
263+
{
264+
"name": "createChangeStream",
265+
"object": "collection0",
266+
"arguments": {
267+
"pipeline": [],
268+
"comment": {
269+
"key": "value"
270+
}
271+
},
272+
"saveResultAsEntity": "changeStream0"
273+
},
274+
{
275+
"name": "insertOne",
276+
"object": "collection0",
277+
"arguments": {
278+
"document": {
279+
"_id": 1,
280+
"a": 1
281+
}
282+
}
283+
},
284+
{
285+
"name": "iterateUntilDocumentOrError",
286+
"object": "changeStream0"
287+
}
288+
],
289+
"expectEvents": [
290+
{
291+
"client": "client0",
292+
"events": [
293+
{
294+
"commandStartedEvent": {
295+
"command": {
296+
"aggregate": "collection0",
297+
"pipeline": [
298+
{
299+
"$changeStream": {}
300+
}
301+
],
302+
"comment": {
303+
"key": "value"
304+
}
305+
}
306+
}
307+
},
308+
{
309+
"commandStartedEvent": {
310+
"command": {
311+
"insert": "collection0",
312+
"documents": [
313+
{
314+
"_id": 1,
315+
"a": 1
316+
}
317+
]
318+
}
319+
}
320+
},
321+
{
322+
"commandStartedEvent": {
323+
"command": {
324+
"getMore": {
325+
"$$type": [
326+
"int",
327+
"long"
328+
]
329+
},
330+
"collection": "collection0",
331+
"comment": {
332+
"key": "value"
333+
}
334+
},
335+
"commandName": "getMore",
336+
"databaseName": "database0"
337+
}
338+
}
339+
]
340+
}
341+
]
342+
},
343+
{
344+
"description": "Test that comment is not set on getMore - pre 4.4",
345+
"runOnRequirements": [
346+
{
347+
"minServerVersion": "3.6.0",
348+
"maxServerVersion": "4.3.99",
349+
"topologies": [
350+
"replicaset"
351+
]
352+
}
353+
],
354+
"operations": [
355+
{
356+
"name": "createChangeStream",
357+
"object": "collection0",
358+
"arguments": {
359+
"pipeline": [],
360+
"comment": "comment"
361+
},
362+
"saveResultAsEntity": "changeStream0"
363+
},
364+
{
365+
"name": "insertOne",
366+
"object": "collection0",
367+
"arguments": {
368+
"document": {
369+
"_id": 1,
370+
"a": 1
371+
}
372+
}
373+
},
374+
{
375+
"name": "iterateUntilDocumentOrError",
376+
"object": "changeStream0"
377+
}
378+
],
379+
"expectEvents": [
380+
{
381+
"client": "client0",
382+
"events": [
383+
{
384+
"commandStartedEvent": {
385+
"command": {
386+
"aggregate": "collection0",
387+
"pipeline": [
388+
{
389+
"$changeStream": {}
390+
}
391+
],
392+
"comment": "comment"
393+
}
394+
}
395+
},
396+
{
397+
"commandStartedEvent": {
398+
"command": {
399+
"insert": "collection0",
400+
"documents": [
401+
{
402+
"_id": 1,
403+
"a": 1
404+
}
405+
]
406+
}
407+
}
408+
},
409+
{
410+
"commandStartedEvent": {
411+
"command": {
412+
"getMore": {
413+
"$$type": [
414+
"int",
415+
"long"
416+
]
417+
},
418+
"collection": "collection0",
419+
"comment": {
420+
"$$exists": false
421+
}
422+
},
423+
"commandName": "getMore",
424+
"databaseName": "database0"
425+
}
426+
}
427+
]
428+
}
429+
]
114430
}
115431
]
116432
}

0 commit comments

Comments
 (0)