-
Notifications
You must be signed in to change notification settings - Fork 39.3k
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
improve procfs.PidOf return error #89718
Conversation
Hi @xigang. Thanks for your PR. I'm waiting for a kubernetes 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. 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/test-infra repository. |
/ok-to-test |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: xigang 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 |
@xigang: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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/test-infra repository. |
/assign @yujuhon |
@xigang: GitHub didn't allow me to assign the following users: yujuhon. Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
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/test-infra repository. |
/ok-to-test |
/assign @yujuhong |
/test pull-kubernetes-node-e2e-containerd |
/test pull-kubernetes-e2e-kind |
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.
/lgtm
pids, err2 := procfs.PidOf(name) | ||
if err2 == nil { | ||
pids, pidsErr := procfs.PidOf(name) | ||
if pidsErr == nil { |
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.
seems like we could change this block and the one above to be like the following:
if pids, err := foo(name); err == nil {
return pids
}
otherwise err and err2 in this same function are equally descriptive...
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.
@derekwaynecarr the modification is completed, please review again.
New changes are detected. LGTM label has been removed. |
@xigang: Adding label 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/test-infra repository. |
/test pull-kubernetes-conformance-kind-ga-only-parallel |
/retest |
/test pull-kubernetes-node-e2e-containerd |
3 similar comments
/test pull-kubernetes-node-e2e-containerd |
/test pull-kubernetes-node-e2e-containerd |
/test pull-kubernetes-node-e2e-containerd |
/retest |
@xigang: The following test failed, say
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/test-infra repository. I understand the commands that are listed here. |
@derekwaynecarr the pull-kubernetes-node-e2e-containerd test case fails:( |
pids, err2 := procfs.PidOf(name) | ||
if err2 == nil { | ||
pids, err := procfs.PidOf(name) | ||
if err == nil { |
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 stuff is tricky :) Re the comment on line 813, don't we want to log/return the error from getPidFromFile
? When we assign err
here, we overwrite that value.
I think, if err
is defined inline, than its online available in the scope of the if
statement - see https://www.calhoun.io/one-liner-if-statements-with-errors/, particularly "This is also why we can have an existing variable named err and then redeclare it inside of an if statement. The new variable is in a new scope, so it is permitted by the compiler.".
So I think we want to use the exact code @derekwaynecarr linked :)
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Thank you for the proposed change. It appears the change is not using the idiomatic style suggested here: I am closing this PR given it is stale, but feel free to re-open and make the requested change at a later time. |
improve procfs.PidOf return error
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
none
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: