Skip to content

Commit f46bbdd

Browse files
authored
Sync CRUD unified tests (#1543)
1 parent e8b814b commit f46bbdd

File tree

5 files changed

+982
-0
lines changed

5 files changed

+982
-0
lines changed
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
{
2+
"description": "BulkWrite replaceOne-sort",
3+
"schemaVersion": "1.0",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"observeEvents": [
9+
"commandStartedEvent",
10+
"commandSucceededEvent"
11+
]
12+
}
13+
},
14+
{
15+
"database": {
16+
"id": "database0",
17+
"client": "client0",
18+
"databaseName": "crud-tests"
19+
}
20+
},
21+
{
22+
"collection": {
23+
"id": "collection0",
24+
"database": "database0",
25+
"collectionName": "coll0"
26+
}
27+
}
28+
],
29+
"initialData": [
30+
{
31+
"collectionName": "coll0",
32+
"databaseName": "crud-tests",
33+
"documents": [
34+
{
35+
"_id": 1,
36+
"x": 11
37+
},
38+
{
39+
"_id": 2,
40+
"x": 22
41+
},
42+
{
43+
"_id": 3,
44+
"x": 33
45+
}
46+
]
47+
}
48+
],
49+
"tests": [
50+
{
51+
"description": "BulkWrite replaceOne with sort option",
52+
"runOnRequirements": [
53+
{
54+
"minServerVersion": "8.0"
55+
}
56+
],
57+
"operations": [
58+
{
59+
"object": "collection0",
60+
"name": "bulkWrite",
61+
"arguments": {
62+
"requests": [
63+
{
64+
"replaceOne": {
65+
"filter": {
66+
"_id": {
67+
"$gt": 1
68+
}
69+
},
70+
"sort": {
71+
"_id": -1
72+
},
73+
"replacement": {
74+
"x": 1
75+
}
76+
}
77+
}
78+
]
79+
}
80+
}
81+
],
82+
"expectEvents": [
83+
{
84+
"client": "client0",
85+
"events": [
86+
{
87+
"commandStartedEvent": {
88+
"command": {
89+
"update": "coll0",
90+
"updates": [
91+
{
92+
"q": {
93+
"_id": {
94+
"$gt": 1
95+
}
96+
},
97+
"u": {
98+
"x": 1
99+
},
100+
"sort": {
101+
"_id": -1
102+
},
103+
"multi": {
104+
"$$unsetOrMatches": false
105+
},
106+
"upsert": {
107+
"$$unsetOrMatches": false
108+
}
109+
}
110+
]
111+
}
112+
}
113+
},
114+
{
115+
"commandSucceededEvent": {
116+
"reply": {
117+
"ok": 1,
118+
"n": 1
119+
},
120+
"commandName": "update"
121+
}
122+
}
123+
]
124+
}
125+
],
126+
"outcome": [
127+
{
128+
"collectionName": "coll0",
129+
"databaseName": "crud-tests",
130+
"documents": [
131+
{
132+
"_id": 1,
133+
"x": 11
134+
},
135+
{
136+
"_id": 2,
137+
"x": 22
138+
},
139+
{
140+
"_id": 3,
141+
"x": 1
142+
}
143+
]
144+
}
145+
]
146+
},
147+
{
148+
"description": "BulkWrite replaceOne with sort option unsupported (server-side error)",
149+
"runOnRequirements": [
150+
{
151+
"maxServerVersion": "7.99"
152+
}
153+
],
154+
"operations": [
155+
{
156+
"object": "collection0",
157+
"name": "bulkWrite",
158+
"arguments": {
159+
"requests": [
160+
{
161+
"replaceOne": {
162+
"filter": {
163+
"_id": {
164+
"$gt": 1
165+
}
166+
},
167+
"sort": {
168+
"_id": -1
169+
},
170+
"replacement": {
171+
"x": 1
172+
}
173+
}
174+
}
175+
]
176+
},
177+
"expectError": {
178+
"isClientError": false
179+
}
180+
}
181+
],
182+
"expectEvents": [
183+
{
184+
"client": "client0",
185+
"events": [
186+
{
187+
"commandStartedEvent": {
188+
"command": {
189+
"update": "coll0",
190+
"updates": [
191+
{
192+
"q": {
193+
"_id": {
194+
"$gt": 1
195+
}
196+
},
197+
"u": {
198+
"x": 1
199+
},
200+
"sort": {
201+
"_id": -1
202+
},
203+
"multi": {
204+
"$$unsetOrMatches": false
205+
},
206+
"upsert": {
207+
"$$unsetOrMatches": false
208+
}
209+
}
210+
]
211+
}
212+
}
213+
}
214+
]
215+
}
216+
],
217+
"outcome": [
218+
{
219+
"collectionName": "coll0",
220+
"databaseName": "crud-tests",
221+
"documents": [
222+
{
223+
"_id": 1,
224+
"x": 11
225+
},
226+
{
227+
"_id": 2,
228+
"x": 22
229+
},
230+
{
231+
"_id": 3,
232+
"x": 33
233+
}
234+
]
235+
}
236+
]
237+
}
238+
]
239+
}

0 commit comments

Comments
 (0)