Skip to content

Commit

Permalink
Update recovers after successful responses test to use two handle_wit…
Browse files Browse the repository at this point in the history
…h_retry
  • Loading branch information
alextwoods committed Oct 29, 2024
1 parent 565fff7 commit 7f05fdf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
19 changes: 17 additions & 2 deletions gems/aws-sdk-core/spec/aws/plugins/retry_errors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,28 @@ module Plugins
{
response: { status_code: 200, error: nil },
expect: { available_capacity: 10, retries: 2 }
},
}
]

# failure cases ending in success
handle_with_retry(test_case_def)

# after success, new request
test_case_post_success = [
{
response: { status_code: 500, error: service_error },
expect: { available_capacity: 5, retries: 1, delay: 1 }
},
{
response: { status_code: 200, error: nil },
expect: { available_capacity: 10, retries: 1 }
}
]
handle_with_retry(test_case_def)
# reset request
config.max_attempts = 2
resp.context.retries = 0
resp.context.metadata[:retries] = {}
handle_with_retry(test_case_post_success)
end

it 'corrects and retries clock skew errors' do
Expand Down
8 changes: 8 additions & 0 deletions gems/aws-sdk-core/spec/retry_errors_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@ def handle_with_retry(test_cases)
resp
end

expect(i).to(
eq(test_cases.size),
"Wrong number of retries. Handler was called #{i} times but "\
"#{test_cases.size} test cases were defined."
)

# Handle has finished called. Apply final expectations.
apply_expectations(test_cases[i - 1])
end



# apply a delay to the current test case
# See handle_with_retry for test case definition
def apply_delay(test_case)
Expand Down

0 comments on commit 7f05fdf

Please sign in to comment.