etcd icon indicating copy to clipboard operation
etcd copied to clipboard

tests: remaining errors.Is conversions

Open redwrasse opened this issue 1 year ago • 14 comments

tests directory errors.Is conversions, as part of https://github.com/etcd-io/etcd/issues/18576

redwrasse avatar Sep 24 '24 04:09 redwrasse

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.

k8s-ci-robot avatar Sep 24 '24 04:09 k8s-ci-robot

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

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 68.75%. Comparing base (54db7f0) to head (eabdc8d).

:exclamation: Current head eabdc8d differs from pull request most recent head 1c825ad

Please upload reports for the commit 1c825ad to get more accurate results.

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

Additional details and impacted files

see 20 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #18634      +/-   ##
==========================================
- Coverage   68.79%   68.75%   -0.05%     
==========================================
  Files         420      420              
  Lines       35493    35492       -1     
==========================================
- Hits        24419    24403      -16     
- Misses       9648     9660      +12     
- Partials     1426     1429       +3     

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 54db7f0...1c825ad. Read the comment docs.

codecov-commenter avatar Sep 24 '24 05:09 codecov-commenter

Hi @redwrasse, thanks for opening this pull request. I know this is a draft, but I see the following instances that need to be updated:

  • tests/integration/v3_grpc_test.go:1565: if err != nil && err != context.DeadlineExceeded {
  • tests/integration/v3_lease_test.go:1089: if terr != nil && terr != gofail.ErrDisabled {
  • tests/integration/clientv3/maintenance_test.go:307: if err != nil && err != context.Canceled {
  • tests/integration/clientv3/watch_test.go:812: if err := cli.Close(); err != nil && err != context.Canceled {

ivanvc avatar Sep 24 '24 17:09 ivanvc

Added those is @ivanvc . Let me know if you see anymore, otherwise I'll mark this ready for review.

redwrasse avatar Sep 25 '24 00:09 redwrasse

I suggest to address nil error before calling errors.Is()

By the way, have you considered activate errorlint with golangci, that can be very helpful.

You can see how I did that on prometheus if you need an idea on how to split the work

Thanks for the suggestions, @mmorel-35. I was looking for a linter rule but couldn't find one (refer to: https://github.com/etcd-io/etcd/pull/18510#issuecomment-2364184198). We're tracking the work in the parent task #18576.

Given the changes you suggested, it may be a good idea to revise the merged PRs. @redwrasse, are you okay with opening this to more contributors? @mmorel-35, would you be interested in working on this, too?

ivanvc avatar Oct 06 '24 23:10 ivanvc

@ivanvc and @mmorel-35 - definitely open to more contributors! Let me know how you'd like to proceed.

redwrasse avatar Oct 07 '24 07:10 redwrasse

I believe it can be splitted per module. I'm starting with go.etcd.io/etcd/client/v2

mmorel-35 avatar Oct 11 '24 17:10 mmorel-35

Thank you so much, @mmorel-35 :bow: :star2:

ivanvc avatar Oct 11 '24 20:10 ivanvc

It seems like nil testing is not really necessary as this already handled by errors.As and errors.Is

mmorel-35 avatar Oct 11 '24 20:10 mmorel-35

/test all

ivanvc avatar Oct 15 '24 16:10 ivanvc

Hi @redwrasse, I enabled errorlint, as Matthieu suggested, and do see some issues comparing errors with ==. If you don't have the bandwidth to continue working on this right now, we could undraft this pull request, merge it, and work on the remaining issues in a follow-up pull request. What do you think?

Thanks again for your help!

Edit: If you mark it as ready for review, can you rebase it? The checks that failed should be working on the main branch now. Thanks.

ivanvc avatar Oct 15 '24 19:10 ivanvc

@ivanvc apologies, I completely forgot about/lost track of this PR. Yes, let me rebase and open for review, and the remaining issues can be a separate PR.

redwrasse avatar Oct 15 '24 21:10 redwrasse

Rebased, squashed, opened for review. Hopefully this one is good to go.

redwrasse avatar Oct 15 '24 22:10 redwrasse

/cc @ahrtr

ivanvc avatar Oct 24 '24 05:10 ivanvc

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrtr, ivanvc, mmorel-35, redwrasse

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

The pull request process is described 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 avatar Oct 24 '24 07:10 k8s-ci-robot