Skip to content

Commit 7c56a95

Browse files
GODRIVER-3444 Add test when maxAwaitTimeMS is lt remaining timeout
1 parent 78d495d commit 7c56a95

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

testdata/client-side-operations-timeout/tailable-awaitData.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,60 @@
471471
]
472472
}
473473
]
474+
},
475+
{
476+
"description": "apply maxAwaitTimeMS if less than remaining timeout",
477+
"operations": [
478+
{
479+
"name": "createFindCursor",
480+
"object": "collection",
481+
"arguments": {
482+
"filter": {},
483+
"cursorType": "tailableAwait",
484+
"batchSize": 1,
485+
"maxAwaitTimeMS": 50
486+
},
487+
"saveResultAsEntity": "tailableCursor"
488+
},
489+
{
490+
"name": "iterateOnce",
491+
"object": "tailableCursor",
492+
"arguments": {
493+
"timeoutMS": 100
494+
}
495+
},
496+
{
497+
"name": "iterateOnce",
498+
"object": "tailableCursor",
499+
"arguments": {
500+
"timeoutMS": 100
501+
}
502+
}
503+
],
504+
"expectEvents": [
505+
{
506+
"client": "client",
507+
"events": [
508+
{
509+
"commandStartedEvent": {
510+
"commandName": "find",
511+
"databaseName": "test"
512+
}
513+
},
514+
{
515+
"commandStartedEvent": {
516+
"commandName": "getMore",
517+
"databaseName": "test",
518+
"command": {
519+
"maxTimeMS": {
520+
"$$lte": 50
521+
}
522+
}
523+
}
524+
}
525+
]
526+
}
527+
]
474528
}
475529
]
476530
}

testdata/client-side-operations-timeout/tailable-awaitData.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,34 @@ tests:
276276
databaseName: *databaseName
277277
command:
278278
maxTimeMS: { $$lte: 50 }
279+
280+
- description: "apply maxAwaitTimeMS if less than remaining timeout"
281+
operations:
282+
- name: createFindCursor
283+
object: *collection
284+
arguments:
285+
filter: {}
286+
cursorType: tailableAwait
287+
batchSize: 1
288+
maxAwaitTimeMS: 50
289+
saveResultAsEntity: &tailableCursor tailableCursor
290+
# Iterate twice to force a getMore.
291+
- name: iterateOnce
292+
object: *tailableCursor
293+
arguments:
294+
timeoutMS: 100
295+
- name: iterateOnce
296+
object: *tailableCursor
297+
arguments:
298+
timeoutMS: 100
299+
expectEvents:
300+
- client: *client
301+
events:
302+
- commandStartedEvent:
303+
commandName: find
304+
databaseName: *databaseName
305+
- commandStartedEvent:
306+
commandName: getMore
307+
databaseName: *databaseName
308+
command:
309+
maxTimeMS: { $$lte: 50 }

0 commit comments

Comments
 (0)