Skip to content

Commit a40659c

Browse files
authored
Sync collection-management unified tests (#1021)
* Resolve CDRIVER-4359, CDRIVER-4368, and CDRIVER-4392 * Add support for modifyCollection operation in unified test runner * Ensure error parameter is initialized * Permit listIndexes arguments field to be null * Update collection-management unified tests
1 parent 2b7b65e commit a40659c

File tree

5 files changed

+548
-2
lines changed

5 files changed

+548
-2
lines changed
Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
{
2+
"description": "clustered-indexes",
3+
"schemaVersion": "1.4",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "5.3",
7+
"serverless": "forbid"
8+
}
9+
],
10+
"createEntities": [
11+
{
12+
"client": {
13+
"id": "client0",
14+
"observeEvents": [
15+
"commandStartedEvent"
16+
]
17+
}
18+
},
19+
{
20+
"database": {
21+
"id": "database0",
22+
"client": "client0",
23+
"databaseName": "ci-tests"
24+
}
25+
},
26+
{
27+
"collection": {
28+
"id": "collection0",
29+
"database": "database0",
30+
"collectionName": "test"
31+
}
32+
}
33+
],
34+
"initialData": [
35+
{
36+
"collectionName": "test",
37+
"databaseName": "ci-tests",
38+
"documents": []
39+
}
40+
],
41+
"tests": [
42+
{
43+
"description": "createCollection with clusteredIndex",
44+
"operations": [
45+
{
46+
"name": "dropCollection",
47+
"object": "database0",
48+
"arguments": {
49+
"collection": "test"
50+
}
51+
},
52+
{
53+
"name": "createCollection",
54+
"object": "database0",
55+
"arguments": {
56+
"collection": "test",
57+
"clusteredIndex": {
58+
"key": {
59+
"_id": 1
60+
},
61+
"unique": true,
62+
"name": "test index"
63+
}
64+
}
65+
},
66+
{
67+
"name": "assertCollectionExists",
68+
"object": "testRunner",
69+
"arguments": {
70+
"databaseName": "ci-tests",
71+
"collectionName": "test"
72+
}
73+
}
74+
],
75+
"expectEvents": [
76+
{
77+
"client": "client0",
78+
"events": [
79+
{
80+
"commandStartedEvent": {
81+
"command": {
82+
"drop": "test"
83+
},
84+
"databaseName": "ci-tests"
85+
}
86+
},
87+
{
88+
"commandStartedEvent": {
89+
"command": {
90+
"create": "test",
91+
"clusteredIndex": {
92+
"key": {
93+
"_id": 1
94+
},
95+
"unique": true,
96+
"name": "test index"
97+
}
98+
},
99+
"databaseName": "ci-tests"
100+
}
101+
}
102+
]
103+
}
104+
]
105+
},
106+
{
107+
"description": "listCollections includes clusteredIndex",
108+
"operations": [
109+
{
110+
"name": "dropCollection",
111+
"object": "database0",
112+
"arguments": {
113+
"collection": "test"
114+
}
115+
},
116+
{
117+
"name": "createCollection",
118+
"object": "database0",
119+
"arguments": {
120+
"collection": "test",
121+
"clusteredIndex": {
122+
"key": {
123+
"_id": 1
124+
},
125+
"unique": true,
126+
"name": "test index"
127+
}
128+
}
129+
},
130+
{
131+
"name": "listCollections",
132+
"object": "database0",
133+
"arguments": {
134+
"filter": {
135+
"name": {
136+
"$eq": "test"
137+
}
138+
}
139+
},
140+
"expectResult": [
141+
{
142+
"name": "test",
143+
"options": {
144+
"clusteredIndex": {
145+
"key": {
146+
"_id": 1
147+
},
148+
"unique": true,
149+
"name": "test index",
150+
"v": {
151+
"$$type": [
152+
"int",
153+
"long"
154+
]
155+
}
156+
}
157+
}
158+
}
159+
]
160+
}
161+
],
162+
"expectEvents": [
163+
{
164+
"client": "client0",
165+
"events": [
166+
{
167+
"commandStartedEvent": {
168+
"command": {
169+
"drop": "test"
170+
},
171+
"databaseName": "ci-tests"
172+
}
173+
},
174+
{
175+
"commandStartedEvent": {
176+
"command": {
177+
"create": "test",
178+
"clusteredIndex": {
179+
"key": {
180+
"_id": 1
181+
},
182+
"unique": true,
183+
"name": "test index"
184+
}
185+
},
186+
"databaseName": "ci-tests"
187+
}
188+
},
189+
{
190+
"commandStartedEvent": {
191+
"command": {
192+
"listCollections": 1,
193+
"filter": {
194+
"name": {
195+
"$eq": "test"
196+
}
197+
}
198+
},
199+
"databaseName": "ci-tests"
200+
}
201+
}
202+
]
203+
}
204+
]
205+
},
206+
{
207+
"description": "listIndexes returns the index",
208+
"operations": [
209+
{
210+
"name": "dropCollection",
211+
"object": "database0",
212+
"arguments": {
213+
"collection": "test"
214+
}
215+
},
216+
{
217+
"name": "createCollection",
218+
"object": "database0",
219+
"arguments": {
220+
"collection": "test",
221+
"clusteredIndex": {
222+
"key": {
223+
"_id": 1
224+
},
225+
"unique": true,
226+
"name": "test index"
227+
}
228+
}
229+
},
230+
{
231+
"name": "listIndexes",
232+
"object": "collection0",
233+
"expectResult": [
234+
{
235+
"key": {
236+
"_id": 1
237+
},
238+
"name": "test index",
239+
"clustered": true,
240+
"unique": true,
241+
"v": {
242+
"$$type": [
243+
"int",
244+
"long"
245+
]
246+
}
247+
}
248+
]
249+
}
250+
],
251+
"expectEvents": [
252+
{
253+
"client": "client0",
254+
"events": [
255+
{
256+
"commandStartedEvent": {
257+
"command": {
258+
"drop": "test"
259+
},
260+
"databaseName": "ci-tests"
261+
}
262+
},
263+
{
264+
"commandStartedEvent": {
265+
"command": {
266+
"create": "test",
267+
"clusteredIndex": {
268+
"key": {
269+
"_id": 1
270+
},
271+
"unique": true,
272+
"name": "test index"
273+
}
274+
},
275+
"databaseName": "ci-tests"
276+
}
277+
},
278+
{
279+
"commandStartedEvent": {
280+
"command": {
281+
"listIndexes": "test"
282+
},
283+
"databaseName": "ci-tests"
284+
}
285+
}
286+
]
287+
}
288+
]
289+
}
290+
]
291+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"description": "createCollection-pre_and_post_images",
3+
"schemaVersion": "1.4",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "6.0",
7+
"serverless": "forbid"
8+
}
9+
],
10+
"createEntities": [
11+
{
12+
"client": {
13+
"id": "client0",
14+
"observeEvents": [
15+
"commandStartedEvent"
16+
]
17+
}
18+
},
19+
{
20+
"database": {
21+
"id": "database0",
22+
"client": "client0",
23+
"databaseName": "papi-tests"
24+
}
25+
},
26+
{
27+
"collection": {
28+
"id": "collection0",
29+
"database": "database0",
30+
"collectionName": "test"
31+
}
32+
}
33+
],
34+
"tests": [
35+
{
36+
"description": "createCollection with changeStreamPreAndPostImages enabled",
37+
"operations": [
38+
{
39+
"name": "dropCollection",
40+
"object": "database0",
41+
"arguments": {
42+
"collection": "test"
43+
}
44+
},
45+
{
46+
"name": "createCollection",
47+
"object": "database0",
48+
"arguments": {
49+
"collection": "test",
50+
"changeStreamPreAndPostImages": {
51+
"enabled": true
52+
}
53+
}
54+
},
55+
{
56+
"name": "assertCollectionExists",
57+
"object": "testRunner",
58+
"arguments": {
59+
"databaseName": "papi-tests",
60+
"collectionName": "test"
61+
}
62+
}
63+
],
64+
"expectEvents": [
65+
{
66+
"client": "client0",
67+
"events": [
68+
{
69+
"commandStartedEvent": {
70+
"command": {
71+
"drop": "test"
72+
},
73+
"databaseName": "papi-tests"
74+
}
75+
},
76+
{
77+
"commandStartedEvent": {
78+
"command": {
79+
"create": "test",
80+
"changeStreamPreAndPostImages": {
81+
"enabled": true
82+
}
83+
},
84+
"databaseName": "papi-tests"
85+
}
86+
}
87+
]
88+
}
89+
]
90+
}
91+
]
92+
}

0 commit comments

Comments
 (0)