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

Remaining errors.Is for error equality checks #18551

Closed
wants to merge 2 commits into from

Conversation

redwrasse
Copy link
Contributor

@redwrasse redwrasse commented Sep 6, 2024

This PR follows up on #18510 to replace the rest of error equality/inequality checks with errors.Is, which is robust to error wrapping (https://pkg.go.dev/errors#pkg-overview).

Note I believe there are a number of cases of explicit error strings substring matching in tests for that are not covered in this PR. This PR just changes explicit err == and err != to errors.Is and !errors.Is.

@ivanvc

Signed-off-by: redwrasse <mail@redwrasse.io>
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: redwrasse
Once this PR has been reviewed and has the lgtm label, please assign wenjiaswe for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link

Hi @redwrasse. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions 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.

@redwrasse redwrasse changed the title Redwrasse/rest of errors is Remaining errors.Is for error equality checks Sep 6, 2024
@redwrasse
Copy link
Contributor Author

@ivanvc let me know if you see any missing cases. this PR also builds on top of #18510, so we could also close that one and just work on this PR.

@redwrasse
Copy link
Contributor Author

Seeing some package name conflicts, let me fix

@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 61.70213% with 18 lines in your changes missing coverage. Please review.

Project coverage is 68.80%. Comparing base (4a11ca6) to head (799b315).
Report is 2 commits behind head on main.

Current head 799b315 differs from pull request most recent head 1775d5e

Please upload reports for the commit 1775d5e to get more accurate results.

Files with missing lines Patch % Lines
server/etcdserver/api/v2discovery/discovery.go 0.00% 1 Missing and 1 partial ⚠️
server/etcdserver/api/v3discovery/discovery.go 0.00% 1 Missing and 1 partial ⚠️
server/etcdserver/api/v3rpc/watch.go 50.00% 1 Missing and 1 partial ⚠️
server/etcdserver/server.go 66.66% 2 Missing ⚠️
client/v3/client.go 66.66% 0 Missing and 1 partial ⚠️
client/v3/experimental/recipes/key.go 50.00% 1 Missing ⚠️
etcdctl/ctlv3/command/auth_command.go 0.00% 1 Missing ⚠️
pkg/proxy/server.go 50.00% 1 Missing ⚠️
server/etcdserver/api/rafthttp/snapshot_sender.go 0.00% 0 Missing and 1 partial ⚠️
server/etcdserver/api/v3rpc/lease.go 83.33% 0 Missing and 1 partial ⚠️
... and 4 more

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
Files with missing lines Coverage Δ
client/v3/watch.go 93.24% <100.00%> (-1.00%) ⬇️
server/etcdserver/api/rafthttp/pipeline.go 97.40% <100.00%> (ø)
server/etcdserver/api/rafthttp/stream.go 81.58% <100.00%> (-0.24%) ⬇️
server/etcdserver/api/v3compactor/periodic.go 90.24% <100.00%> (ø)
server/etcdserver/api/v3rpc/util.go 51.61% <100.00%> (ø)
server/lease/leasehttp/http.go 64.18% <100.00%> (+2.02%) ⬆️
client/v3/client.go 84.89% <66.66%> (ø)
client/v3/experimental/recipes/key.go 75.34% <50.00%> (ø)
etcdctl/ctlv3/command/auth_command.go 0.00% <0.00%> (ø)
pkg/proxy/server.go 60.95% <50.00%> (+0.67%) ⬆️
... and 10 more

... and 19 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #18551      +/-   ##
==========================================
+ Coverage   68.73%   68.80%   +0.07%     
==========================================
  Files         420      420              
  Lines       35470    35470              
==========================================
+ Hits        24381    24406      +25     
+ Misses       9668     9647      -21     
+ Partials     1421     1417       -4     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a11ca6...1775d5e. Read the comment docs.

@redwrasse redwrasse marked this pull request as ready for review September 6, 2024 05:32
@henrybear327
Copy link
Contributor

/ok-to-test

@redwrasse
Copy link
Contributor Author

goimports error, i'll fix it

Signed-off-by: redwrasse <mail@redwrasse.io>
@k8s-ci-robot
Copy link

@redwrasse: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-etcd-unit-test-386 1775d5e link true /test pull-etcd-unit-test-386
pull-etcd-integration-1-cpu-amd64 1775d5e link true /test pull-etcd-integration-1-cpu-amd64

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions 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. I understand the commands that are listed here.

@ivanvc
Copy link
Member

ivanvc commented Sep 12, 2024

Hi @redwrasse, thanks for the pull request. Due to its size and ease of review, would you be able to help us break it into multiple smaller PRs? I suggest one per module, i.e., client, contrib, etcdctl, etc...

I also suggest waiting for #18510 to be merged so you can continue working on it after we have the maintainers' approval and get it merged into main.

Thanks again, Samir.

@ivanvc
Copy link
Member

ivanvc commented Sep 12, 2024

Link to #18576

@redwrasse
Copy link
Contributor Author

@ivanvc sounds good, I'll hold off for now and if we move forward I can help with a separate PR per-module.

@ivanvc
Copy link
Member

ivanvc commented Sep 12, 2024

@redwrasse, is it okay to assign you to our new parent issue for this? (#18576) If that's ok, you can comment /assign on that issue, and k8s-bot will assign it to you.

@redwrasse
Copy link
Contributor Author

Closing this PR, since as discussed the remaining errors.Is changes PRs should be submitted per-module.

@redwrasse redwrasse closed this Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants