Skip to content

Commit 7cad02c

Browse files
getMore tests
1 parent e1f00b7 commit 7cad02c

File tree

2 files changed

+192
-1
lines changed

2 files changed

+192
-1
lines changed

test/spec/client-backpressure/getMore-retried.json

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,131 @@
156156
]
157157
}
158158
]
159+
},
160+
{
161+
"description": "getMores are retried maxAttempts=5 times",
162+
"operations": [
163+
{
164+
"name": "failPoint",
165+
"object": "testRunner",
166+
"arguments": {
167+
"client": "failPointClient",
168+
"failPoint": {
169+
"configureFailPoint": "failCommand",
170+
"mode": "alwaysOn",
171+
"data": {
172+
"failCommands": [
173+
"getMore"
174+
],
175+
"errorLabels": [
176+
"RetryableError",
177+
"SystemOverloadedError"
178+
],
179+
"errorCode": 2
180+
}
181+
}
182+
}
183+
},
184+
{
185+
"name": "find",
186+
"arguments": {
187+
"batchSize": 2,
188+
"filter": {}
189+
},
190+
"object": "coll",
191+
"expectError": {
192+
"isError": true,
193+
"isClientError": false
194+
}
195+
}
196+
],
197+
"expectEvents": [
198+
{
199+
"client": "client0",
200+
"events": [
201+
{
202+
"commandStartedEvent": {
203+
"commandName": "find"
204+
}
205+
},
206+
{
207+
"commandSucceededEvent": {
208+
"commandName": "find"
209+
}
210+
},
211+
{
212+
"commandStartedEvent": {
213+
"commandName": "getMore"
214+
}
215+
},
216+
{
217+
"commandFailedEvent": {
218+
"commandName": "getMore"
219+
}
220+
},
221+
{
222+
"commandStartedEvent": {
223+
"commandName": "getMore"
224+
}
225+
},
226+
{
227+
"commandFailedEvent": {
228+
"commandName": "getMore"
229+
}
230+
},
231+
{
232+
"commandStartedEvent": {
233+
"commandName": "getMore"
234+
}
235+
},
236+
{
237+
"commandFailedEvent": {
238+
"commandName": "getMore"
239+
}
240+
},
241+
{
242+
"commandStartedEvent": {
243+
"commandName": "getMore"
244+
}
245+
},
246+
{
247+
"commandFailedEvent": {
248+
"commandName": "getMore"
249+
}
250+
},
251+
{
252+
"commandStartedEvent": {
253+
"commandName": "getMore"
254+
}
255+
},
256+
{
257+
"commandFailedEvent": {
258+
"commandName": "getMore"
259+
}
260+
},
261+
{
262+
"commandStartedEvent": {
263+
"commandName": "getMore"
264+
}
265+
},
266+
{
267+
"commandFailedEvent": {
268+
"commandName": "getMore"
269+
}
270+
},
271+
{
272+
"commandStartedEvent": {
273+
"commandName": "killCursors"
274+
}
275+
},
276+
{
277+
"commandSucceededEvent": {
278+
"commandName": "killCursors"
279+
}
280+
}
281+
]
282+
}
283+
]
159284
}
160285
]
161286
}

test/spec/client-backpressure/getMore-retried.yml

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ tests:
4343

4444
- name: find
4545
arguments:
46+
# batch size of 2 with 3 docs in the collection ensures exactly one find + one getMore exhaust the cursor
4647
batchSize: 2
4748
filter: {}
4849
# ensure stable ordering of result documents
@@ -78,4 +79,69 @@ tests:
7879
- commandStartedEvent:
7980
commandName: getMore
8081
- commandSucceededEvent:
81-
commandName: getMore
82+
commandName: getMore
83+
84+
- description: "getMores are retried maxAttempts=5 times"
85+
operations:
86+
- name: failPoint
87+
object: testRunner
88+
arguments:
89+
client: *failPointClient
90+
failPoint:
91+
configureFailPoint: failCommand
92+
mode: alwaysOn
93+
data:
94+
failCommands: [getMore]
95+
errorLabels: [RetryableError, SystemOverloadedError]
96+
errorCode: 2
97+
98+
- name: find
99+
arguments:
100+
batchSize: 2
101+
filter: {}
102+
object: *collection
103+
expectError:
104+
isError: true
105+
isClientError: false
106+
107+
expectEvents:
108+
- client: *client
109+
events:
110+
- commandStartedEvent:
111+
commandName: find
112+
- commandSucceededEvent:
113+
commandName: find
114+
# first attempt
115+
- commandStartedEvent:
116+
commandName: getMore
117+
- commandFailedEvent:
118+
commandName: getMore
119+
# second attempt
120+
- commandStartedEvent:
121+
commandName: getMore
122+
- commandFailedEvent:
123+
commandName: getMore
124+
# third attempt
125+
- commandStartedEvent:
126+
commandName: getMore
127+
- commandFailedEvent:
128+
commandName: getMore
129+
# fourth attempt
130+
- commandStartedEvent:
131+
commandName: getMore
132+
- commandFailedEvent:
133+
commandName: getMore
134+
# fifth attempt
135+
- commandStartedEvent:
136+
commandName: getMore
137+
- commandFailedEvent:
138+
commandName: getMore
139+
# final attempt
140+
- commandStartedEvent:
141+
commandName: getMore
142+
- commandFailedEvent:
143+
commandName: getMore
144+
- commandStartedEvent:
145+
commandName: killCursors
146+
- commandSucceededEvent:
147+
commandName: killCursors

0 commit comments

Comments
 (0)