File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -310,13 +310,28 @@ module Plugins
310
310
{
311
311
response : { status_code : 200 , error : nil } ,
312
312
expect : { available_capacity : 10 , retries : 2 }
313
- } ,
313
+ }
314
+ ]
315
+
316
+ # failure cases ending in success
317
+ handle_with_retry ( test_case_def )
318
+
319
+ # after success, new request
320
+ test_case_post_success = [
314
321
{
315
322
response : { status_code : 500 , error : service_error } ,
316
323
expect : { available_capacity : 5 , retries : 1 , delay : 1 }
324
+ } ,
325
+ {
326
+ response : { status_code : 200 , error : nil } ,
327
+ expect : { available_capacity : 10 , retries : 1 }
317
328
}
318
329
]
319
- handle_with_retry ( test_case_def )
330
+ # reset request
331
+ config . max_attempts = 2
332
+ resp . context . retries = 0
333
+ resp . context . metadata [ :retries ] = { }
334
+ handle_with_retry ( test_case_post_success )
320
335
end
321
336
322
337
it 'corrects and retries clock skew errors' do
Original file line number Diff line number Diff line change @@ -30,10 +30,18 @@ def handle_with_retry(test_cases)
30
30
resp
31
31
end
32
32
33
+ expect ( i ) . to (
34
+ eq ( test_cases . size ) ,
35
+ "Wrong number of retries. Handler was called #{ i } times but " \
36
+ "#{ test_cases . size } test cases were defined."
37
+ )
38
+
33
39
# Handle has finished called. Apply final expectations.
34
40
apply_expectations ( test_cases [ i - 1 ] )
35
41
end
36
42
43
+
44
+
37
45
# apply a delay to the current test case
38
46
# See handle_with_retry for test case definition
39
47
def apply_delay ( test_case )
You can’t perform that action at this time.
0 commit comments