Skip to content

Commit bf372a1

Browse files
authored
DRIVERS-1096: Split showRecordId/returnKey into separate test (#1238)
1 parent 631ee98 commit bf372a1

File tree

2 files changed

+117
-20
lines changed

2 files changed

+117
-20
lines changed

source/command-monitoring/tests/unified/find.json

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@
123123
}
124124
},
125125
"sort": {
126-
"_id": 1
126+
"x": -1
127+
},
128+
"projection": {
129+
"_id": 0,
130+
"x": 1
127131
},
128132
"skip": 2,
129133
"comment": "test",
@@ -136,9 +140,7 @@
136140
"maxTimeMS": 6000,
137141
"min": {
138142
"_id": 0
139-
},
140-
"returnKey": false,
141-
"showRecordId": false
143+
}
142144
}
143145
}
144146
],
@@ -156,7 +158,11 @@
156158
}
157159
},
158160
"sort": {
159-
"_id": 1
161+
"x": -1
162+
},
163+
"projection": {
164+
"_id": 0,
165+
"x": 1
160166
},
161167
"skip": 2,
162168
"comment": "test",
@@ -169,9 +175,7 @@
169175
"maxTimeMS": 6000,
170176
"min": {
171177
"_id": 0
172-
},
173-
"returnKey": false,
174-
"showRecordId": false
178+
}
175179
},
176180
"commandName": "find",
177181
"databaseName": "command-monitoring-tests"
@@ -186,12 +190,74 @@
186190
"ns": "command-monitoring-tests.test",
187191
"firstBatch": [
188192
{
189-
"_id": 4,
190-
"x": 44
193+
"x": 33
191194
},
192195
{
193-
"_id": 5,
194-
"x": 55
196+
"x": 22
197+
}
198+
]
199+
}
200+
},
201+
"commandName": "find"
202+
}
203+
}
204+
]
205+
}
206+
]
207+
},
208+
{
209+
"description": "A successful find with showRecordId and returnKey",
210+
"operations": [
211+
{
212+
"name": "find",
213+
"object": "collection",
214+
"arguments": {
215+
"filter": {},
216+
"sort": {
217+
"_id": 1
218+
},
219+
"showRecordId": true,
220+
"returnKey": true
221+
}
222+
}
223+
],
224+
"expectEvents": [
225+
{
226+
"client": "client",
227+
"events": [
228+
{
229+
"commandStartedEvent": {
230+
"command": {
231+
"find": "test",
232+
"showRecordId": true,
233+
"returnKey": true
234+
},
235+
"commandName": "find",
236+
"databaseName": "command-monitoring-tests"
237+
}
238+
},
239+
{
240+
"commandSucceededEvent": {
241+
"reply": {
242+
"ok": 1,
243+
"cursor": {
244+
"id": 0,
245+
"ns": "command-monitoring-tests.test",
246+
"firstBatch": [
247+
{
248+
"_id": 1
249+
},
250+
{
251+
"_id": 2
252+
},
253+
{
254+
"_id": 3
255+
},
256+
{
257+
"_id": 4
258+
},
259+
{
260+
"_id": 5
195261
}
196262
]
197263
}

source/command-monitoring/tests/unified/find.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,29 @@ tests:
6363
object: *collection
6464
arguments:
6565
filter: { _id: { $gt: 1 } }
66-
sort: { _id: 1 }
66+
sort: { x: -1 }
67+
projection: { _id: 0, x: 1 }
6768
skip: 2
6869
comment: "test"
6970
hint: { _id: 1 }
7071
max: { _id: 6 }
7172
maxTimeMS: 6000
7273
min: { _id: 0 }
73-
returnKey: false
74-
showRecordId: false
7574
expectEvents:
7675
- client: *client
7776
events:
7877
- commandStartedEvent:
7978
command:
8079
find: *collectionName
8180
filter: { _id: { $gt: 1 } }
82-
sort: { _id: 1 }
81+
sort: { x: -1 }
82+
projection: { _id: 0, x: 1 }
8383
skip: 2
8484
comment: "test"
8585
hint: { _id: 1 }
8686
max: { _id: 6 }
8787
maxTimeMS: 6000
8888
min: { _id: 0 }
89-
returnKey: false
90-
showRecordId: false
9189
commandName: find
9290
databaseName: *databaseName
9391
- commandSucceededEvent:
@@ -97,8 +95,41 @@ tests:
9795
id: 0
9896
ns: *namespace
9997
firstBatch:
100-
- { _id: 4, x: 44 }
101-
- { _id: 5, x: 55 }
98+
- { x: 33 }
99+
- { x: 22 }
100+
commandName: find
101+
102+
- description: "A successful find with showRecordId and returnKey"
103+
operations:
104+
- name: find
105+
object: *collection
106+
arguments:
107+
filter: { }
108+
sort: { _id: 1 }
109+
showRecordId: true
110+
returnKey: true
111+
expectEvents:
112+
- client: *client
113+
events:
114+
- commandStartedEvent:
115+
command:
116+
find: *collectionName
117+
showRecordId: true
118+
returnKey: true
119+
commandName: find
120+
databaseName: *databaseName
121+
- commandSucceededEvent:
122+
reply:
123+
ok: 1
124+
cursor:
125+
id: 0
126+
ns: *namespace
127+
firstBatch:
128+
- { _id: 1 }
129+
- { _id: 2 }
130+
- { _id: 3 }
131+
- { _id: 4 }
132+
- { _id: 5 }
102133
commandName: find
103134

104135
- description: "A successful find with a getMore"

0 commit comments

Comments
 (0)