Skip to content

Commit 7f05fdf

Browse files
committed
Update recovers after successful responses test to use two handle_with_retry
1 parent 565fff7 commit 7f05fdf

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

gems/aws-sdk-core/spec/aws/plugins/retry_errors_spec.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,28 @@ module Plugins
310310
{
311311
response: { status_code: 200, error: nil },
312312
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 = [
314321
{
315322
response: { status_code: 500, error: service_error },
316323
expect: { available_capacity: 5, retries: 1, delay: 1 }
324+
},
325+
{
326+
response: { status_code: 200, error: nil },
327+
expect: { available_capacity: 10, retries: 1 }
317328
}
318329
]
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)
320335
end
321336

322337
it 'corrects and retries clock skew errors' do

gems/aws-sdk-core/spec/retry_errors_helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,18 @@ def handle_with_retry(test_cases)
3030
resp
3131
end
3232

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+
3339
# Handle has finished called. Apply final expectations.
3440
apply_expectations(test_cases[i - 1])
3541
end
3642

43+
44+
3745
# apply a delay to the current test case
3846
# See handle_with_retry for test case definition
3947
def apply_delay(test_case)

0 commit comments

Comments
 (0)