Skip to content

Commit

Permalink
Add a helper for resetting requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Oct 29, 2024
1 parent 7f05fdf commit b98b975
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 1 addition & 7 deletions gems/aws-sdk-core/spec/aws/plugins/retry_errors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,8 @@ module Plugins
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 },
Expand All @@ -327,10 +324,7 @@ module Plugins
expect: { available_capacity: 10, retries: 1 }
}
]
# reset request
config.max_attempts = 2
resp.context.retries = 0
resp.context.metadata[:retries] = {}
reset_request
handle_with_retry(test_case_post_success)
end

Expand Down
6 changes: 5 additions & 1 deletion gems/aws-sdk-core/spec/retry_errors_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def handle_with_retry(test_cases)
apply_expectations(test_cases[i - 1])
end


# Reset the request context for a subsequent call
def reset_request
resp.context.retries = 0
resp.context.metadata[:retries] = {}
end

# apply a delay to the current test case
# See handle_with_retry for test case definition
Expand Down

0 comments on commit b98b975

Please sign in to comment.