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

tests: remaining errors.Is conversions #18634

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

redwrasse
Copy link
Contributor

@redwrasse redwrasse commented Sep 24, 2024

tests directory errors.Is conversions, as part of #18576

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

@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2024

⚠️ 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 ✅

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

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

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

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

@ivanvc
Copy link
Member

ivanvc commented Sep 24, 2024

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 {

@redwrasse
Copy link
Contributor Author

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

Copy link
Contributor

@mmorel-35 mmorel-35 left a comment

Choose a reason for hiding this comment

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

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

@ivanvc
Copy link
Member

ivanvc commented Oct 6, 2024

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: #18510 (comment)). 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?

@redwrasse
Copy link
Contributor Author

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

@mmorel-35
Copy link
Contributor

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

@ivanvc
Copy link
Member

ivanvc commented Oct 11, 2024

Thank you so much, @mmorel-35 🙇 🌟

@mmorel-35
Copy link
Contributor

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

@ivanvc
Copy link
Member

ivanvc commented Oct 15, 2024

/test all

@ivanvc
Copy link
Member

ivanvc commented Oct 15, 2024

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.

@redwrasse
Copy link
Contributor Author

@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 redwrasse force-pushed the redwrasse/tests/remaining-errors-is branch from 26d26d0 to 221225e Compare October 15, 2024 21:21
@redwrasse redwrasse marked this pull request as ready for review October 15, 2024 21:22
Signed-off-by: redwrasse <mail@redwrasse.io>
@redwrasse redwrasse force-pushed the redwrasse/tests/remaining-errors-is branch from 221225e to 1c825ad Compare October 15, 2024 21:29
@redwrasse
Copy link
Contributor Author

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

Copy link
Member

@ivanvc ivanvc left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, Samir.

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ivanvc, mmorel-35, redwrasse
Once this PR has been reviewed and has the lgtm label, please assign jmhbnz 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

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