-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Fix broken eqErrGRPC helper function in integration tests
#21131
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: zhijun42 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @zhijun42. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
65eb175 to
5b83768
Compare
| // | ||
| // // For errors from clientv3, use errors.Is() with client-side error types: | ||
| // errors.Is(err, rpctypes.ErrUserEmpty) | ||
| func eqErrGRPC(err1 error, err2 error) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is badly designed, it promises too much, validates too little. Instead of writing a essay on how to use a test function, just panic if user provides incorrect input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Refactored to just panic. And removed my essay.
Signed-off-by: Zhijun <[email protected]>
5b83768 to
bfa1b9c
Compare
| // eqErrGRPC validates both inputs must be gRPC status errors | ||
| // (e.g., rpctypes.ErrGRPCXxx) or nil, and then compares them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of writing comments improve function name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't come up with a better name.
- matchGRPCErrors
- errorsEqualByGRPCStatus
- mustEqualGRPCErrors
- mustGRPCErrorsEqual
- verifyGRPCErrorsEqual
- requireGRPCErrorsEqual
- validateAndCompareGRPCErrors
- grpcStatusCodeAndMessageEqual
The test helper function
eqErrGRPChas always been flawed since introduced in 2016.When the first argument was non-nil (usually the case in tests), it will always return true. This has made all error assertions using this helper effectively no-ops.
Changes:
status.Convert()v3_auth_test.goexposed by the fix (ErrUserEmpty→ErrGRPCUserEmpty)