Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tfawserr.ErrHTTPStatusCodeEquals, AWS SDK for Go v2 variant of v2/awsv1shim/tfawserr.ErrStatusCodeEquals #642

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Sep 5, 2023

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Adds an AWS SDK for Go v2 variant of the ErrStatusCodeEquals helper in v2/awsv1shim/tfawserr.
Renamed to better reflect that it's an HTTP status code we're matching on.
Enhanced with varargs list of status codes.

Relates #524.
Relates #533.

% go test -v -run=TestErrHTTPStatusCodeEquals ./tfawserr
=== RUN   TestErrHTTPStatusCodeEquals
=== RUN   TestErrHTTPStatusCodeEquals/other_error
=== RUN   TestErrHTTPStatusCodeEquals/Wrapped_smithyhttp.ResponseError_matching_first_code
=== RUN   TestErrHTTPStatusCodeEquals/Wrapped_smithyhttp.ResponseError_matching_last_code
=== RUN   TestErrHTTPStatusCodeEquals/Wrapped_smithyhttp.ResponseError_non-matching_codes
=== RUN   TestErrHTTPStatusCodeEquals/nil_error
=== RUN   TestErrHTTPStatusCodeEquals/Top-level_smithyhttp.ResponseError_matching_first_code
=== RUN   TestErrHTTPStatusCodeEquals/Top-level_smithyhttp.ResponseError_matching_last_code
=== RUN   TestErrHTTPStatusCodeEquals/Top-level_smithyhttp.ResponseError_no_code
=== RUN   TestErrHTTPStatusCodeEquals/Top-level_smithyhttp.ResponseError_non-matching_codes
--- PASS: TestErrHTTPStatusCodeEquals (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/other_error (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/Wrapped_smithyhttp.ResponseError_matching_first_code (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/Wrapped_smithyhttp.ResponseError_matching_last_code (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/Wrapped_smithyhttp.ResponseError_non-matching_codes (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/nil_error (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/Top-level_smithyhttp.ResponseError_matching_first_code (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/Top-level_smithyhttp.ResponseError_matching_last_code (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/Top-level_smithyhttp.ResponseError_no_code (0.00s)
    --- PASS: TestErrHTTPStatusCodeEquals/Top-level_smithyhttp.ResponseError_non-matching_codes (0.00s)
PASS
ok  	github.com/hashicorp/aws-sdk-go-base/v2/tfawserr	0.425s

@ewbankkit ewbankkit requested a review from a team as a code owner September 5, 2023 19:52
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

% go test -count=1 -parallel=4 ./...
?       github.com/hashicorp/aws-sdk-go-base/v2/internal/awsconfig      [no test files]
?       github.com/hashicorp/aws-sdk-go-base/v2/internal/constants      [no test files]
?       github.com/hashicorp/aws-sdk-go-base/v2/internal/errs   [no test files]
?       github.com/hashicorp/aws-sdk-go-base/v2/internal/slices [no test files]
?       github.com/hashicorp/aws-sdk-go-base/v2/internal/test   [no test files]
?       github.com/hashicorp/aws-sdk-go-base/v2/mockdata        [no test files]
?       github.com/hashicorp/aws-sdk-go-base/v2/servicemocks    [no test files]
ok      github.com/hashicorp/aws-sdk-go-base/v2 4.791s
ok      github.com/hashicorp/aws-sdk-go-base/v2/diag    0.096s
ok      github.com/hashicorp/aws-sdk-go-base/v2/internal/config 0.298s
ok      github.com/hashicorp/aws-sdk-go-base/v2/internal/endpoints      0.242s
ok      github.com/hashicorp/aws-sdk-go-base/v2/internal/expand 0.351s
ok      github.com/hashicorp/aws-sdk-go-base/v2/logging 0.267s
ok      github.com/hashicorp/aws-sdk-go-base/v2/tfawserr        0.308s
ok      github.com/hashicorp/aws-sdk-go-base/v2/useragent       0.367s

@ewbankkit ewbankkit merged commit 95ea2bd into main Sep 5, 2023
7 checks passed
@ewbankkit ewbankkit deleted the f--aws-sdk-go-v2-ErrStatusCodeEquals branch September 5, 2023 20:07
ewbankkit added a commit that referenced this pull request Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants