Skip to content

Commit 848b948

Browse files
committed
poc to fix readPreference test
1 parent 8f15459 commit 848b948

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

tests/UnifiedSpecTests/run-command/runCommand.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@
163163
},
164164
{
165165
"description": "attaches the provided $readPreference to given command",
166+
"runOnRequirements": [
167+
{
168+
"topologies": [
169+
"replicaset",
170+
"sharded-replicaset",
171+
"load-balanced",
172+
"sharded"
173+
]
174+
}
175+
],
166176
"operations": [
167177
{
168178
"name": "runCommand",
@@ -201,6 +211,53 @@
201211
}
202212
]
203213
},
214+
{
215+
"description": "does not attach $readPreference to given command on standalone",
216+
"runOnRequirements": [
217+
{
218+
"topologies": [
219+
"single"
220+
]
221+
}
222+
],
223+
"operations": [
224+
{
225+
"name": "runCommand",
226+
"object": "db",
227+
"arguments": {
228+
"commandName": "ping",
229+
"command": {
230+
"ping": 1
231+
},
232+
"readPreference": {
233+
"mode": "nearest"
234+
}
235+
},
236+
"expectResult": {
237+
"ok": 1
238+
}
239+
}
240+
],
241+
"expectEvents": [
242+
{
243+
"client": "client",
244+
"events": [
245+
{
246+
"commandStartedEvent": {
247+
"command": {
248+
"ping": 1,
249+
"$readPreference": {
250+
"$$exists": false
251+
},
252+
"$db": "db"
253+
},
254+
"commandName": "ping"
255+
}
256+
}
257+
]
258+
}
259+
]
260+
},
204261
{
205262
"description": "does not inherit readConcern specified at the db level",
206263
"operations": [

0 commit comments

Comments
 (0)