Skip to content

Commit 0224de0

Browse files
fix: support change streams tests
1 parent 1066654 commit 0224de0

File tree

2 files changed

+314
-2
lines changed

2 files changed

+314
-2
lines changed

test/integration/change-streams/change_streams.spec.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ describe('Change Streams Spec - Unified', function () {
1212
runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified')), [
1313
'Test with document comment',
1414
'Test with string comment',
15-
'Test that comment is set on getMore',
16-
'Test with document comment - pre 4.4'
15+
'Test that comment is set on getMore'
1716
]);
1817
});
1918

19+
describe('Change Streams Spec - Node-Specific', function () {
20+
runUnifiedSuite(loadSpecTests(path.join('change-streams', 'node-specific')));
21+
});
22+
2023
// TODO: NODE-3819: Unskip flaky MacOS tests.
2124
const maybeDescribe = process.platform === 'darwin' ? describe.skip : describe;
2225
maybeDescribe('Change Stream Spec - v1', function () {
Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
{
2+
"description": "change-streams",
3+
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"topologies": [
7+
"replicaset",
8+
"sharded-replicaset"
9+
]
10+
}
11+
],
12+
"createEntities": [
13+
{
14+
"client": {
15+
"id": "client0",
16+
"observeEvents": [
17+
"commandStartedEvent"
18+
]
19+
}
20+
},
21+
{
22+
"database": {
23+
"id": "database0",
24+
"client": "client0",
25+
"databaseName": "database0"
26+
}
27+
},
28+
{
29+
"collection": {
30+
"id": "collection0",
31+
"database": "database0",
32+
"collectionName": "collection0"
33+
}
34+
}
35+
],
36+
"initialData": [
37+
{
38+
"collectionName": "collection0",
39+
"databaseName": "database0",
40+
"documents": []
41+
}
42+
],
43+
"tests": [
44+
{
45+
"description": "Test with document comment",
46+
"runOnRequirements": [
47+
{
48+
"minServerVersion": "4.4"
49+
}
50+
],
51+
"operations": [
52+
{
53+
"name": "createChangeStream",
54+
"object": "collection0",
55+
"arguments": {
56+
"pipeline": [],
57+
"comment": {
58+
"name": "test1"
59+
}
60+
},
61+
"saveResultAsEntity": "changeStream0"
62+
}
63+
],
64+
"expectEvents": [
65+
{
66+
"client": "client0",
67+
"events": [
68+
{
69+
"commandStartedEvent": {
70+
"command": {
71+
"aggregate": "collection0",
72+
"pipeline": [
73+
{
74+
"$changeStream": {}
75+
}
76+
],
77+
"comment": {
78+
"name": "test1"
79+
}
80+
}
81+
}
82+
},
83+
{
84+
"commandStartedEvent": {
85+
"command": {
86+
"getMore": {
87+
"$$type": [
88+
"int",
89+
"long"
90+
]
91+
},
92+
"collection": "collection0",
93+
"comment": {
94+
"name": "test1"
95+
}
96+
},
97+
"commandName": "getMore",
98+
"databaseName": "database0"
99+
}
100+
}
101+
]
102+
}
103+
]
104+
},
105+
{
106+
"description": "Test with document comment - pre 4.4",
107+
"runOnRequirements": [
108+
{
109+
"minServerVersion": "3.6.0",
110+
"maxServerVersion": "4.2.99"
111+
}
112+
],
113+
"operations": [
114+
{
115+
"name": "createChangeStream",
116+
"object": "collection0",
117+
"arguments": {
118+
"pipeline": [],
119+
"comment": {
120+
"name": "test1"
121+
}
122+
},
123+
"expectError": {
124+
"isClientError": false
125+
}
126+
}
127+
],
128+
"expectEvents": [
129+
{
130+
"client": "client0",
131+
"events": [
132+
{
133+
"commandStartedEvent": {
134+
"command": {
135+
"aggregate": "collection0",
136+
"pipeline": [
137+
{
138+
"$changeStream": {}
139+
}
140+
],
141+
"comment": {
142+
"name": "test1"
143+
}
144+
}
145+
}
146+
}
147+
]
148+
}
149+
]
150+
},
151+
{
152+
"description": "Test with string comment",
153+
"runOnRequirements": [
154+
{
155+
"minServerVersion": "3.6.0"
156+
}
157+
],
158+
"operations": [
159+
{
160+
"name": "createChangeStream",
161+
"object": "collection0",
162+
"arguments": {
163+
"pipeline": [],
164+
"comment": "comment"
165+
},
166+
"saveResultAsEntity": "changeStream0"
167+
}
168+
],
169+
"expectEvents": [
170+
{
171+
"client": "client0",
172+
"events": [
173+
{
174+
"commandStartedEvent": {
175+
"command": {
176+
"aggregate": "collection0",
177+
"pipeline": [
178+
{
179+
"$changeStream": {}
180+
}
181+
],
182+
"comment": "comment"
183+
}
184+
}
185+
},
186+
{
187+
"commandStartedEvent": {
188+
"command": {
189+
"getMore": {
190+
"$$type": [
191+
"int",
192+
"long"
193+
]
194+
},
195+
"collection": "collection0",
196+
"comment": "comment"
197+
},
198+
"commandName": "getMore",
199+
"databaseName": "database0"
200+
}
201+
}
202+
]
203+
}
204+
]
205+
},
206+
{
207+
"description": "Test that comment is set on getMore",
208+
"runOnRequirements": [
209+
{
210+
"minServerVersion": "4.4.0",
211+
"topologies": [
212+
"single",
213+
"replicaset"
214+
]
215+
}
216+
],
217+
"operations": [
218+
{
219+
"name": "createChangeStream",
220+
"object": "collection0",
221+
"arguments": {
222+
"pipeline": [],
223+
"comment": "comment"
224+
},
225+
"saveResultAsEntity": "changeStream0"
226+
},
227+
{
228+
"name": "insertOne",
229+
"object": "collection0",
230+
"arguments": {
231+
"document": {
232+
"_id": 1,
233+
"a": 1
234+
}
235+
}
236+
},
237+
{
238+
"name": "iterateUntilDocumentOrError",
239+
"object": "changeStream0"
240+
}
241+
],
242+
"expectEvents": [
243+
{
244+
"client": "client0",
245+
"events": [
246+
{
247+
"commandStartedEvent": {
248+
"command": {
249+
"aggregate": "collection0",
250+
"pipeline": [
251+
{
252+
"$changeStream": {}
253+
}
254+
],
255+
"comment": "comment"
256+
}
257+
}
258+
},
259+
{
260+
"commandStartedEvent": {
261+
"command": {
262+
"getMore": {
263+
"$$type": [
264+
"int",
265+
"long"
266+
]
267+
},
268+
"collection": "collection0",
269+
"comment": "comment"
270+
},
271+
"commandName": "getMore",
272+
"databaseName": "database0"
273+
}
274+
},
275+
{
276+
"commandStartedEvent": {
277+
"command": {
278+
"insert": "collection0",
279+
"documents": [
280+
{
281+
"_id": 1,
282+
"a": 1
283+
}
284+
]
285+
}
286+
}
287+
},
288+
{
289+
"commandStartedEvent": {
290+
"command": {
291+
"getMore": {
292+
"$$type": [
293+
"int",
294+
"long"
295+
]
296+
},
297+
"collection": "collection0",
298+
"comment": "comment"
299+
},
300+
"commandName": "getMore",
301+
"databaseName": "database0"
302+
}
303+
}
304+
]
305+
}
306+
]
307+
}
308+
]
309+
}

0 commit comments

Comments
 (0)