-
Notifications
You must be signed in to change notification settings - Fork 423
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
Fix panic when cache file can't be Stat-ed #410
Fix panic when cache file can't be Stat-ed #410
Conversation
Welcome @sarahhodne! |
Hi @sarahhodne. Thanks for your PR. I'm waiting for a kubernetes-sigs 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. |
The code currently assumes that Stat always return a FileInfo object, but if the file can't be Stat-ed (e.g. due to a permissions error), Stat can return a nil FileInfo, plus an error. The error is only handled if it's a "not exists" error, but there are other errors that can be returned too. This wasn't caught by the tests, since the mocked out Stat always returns a FileInfo, even when an error is returned. This commit also changes from os.IsNotExist(err) to errors.Is(err, fs.ErrNotExist) as recommended by the documentation for os.IsNotExist.
7665d13
to
df11e06
Compare
/retest |
Thanks @sarahhodne, nice fix. |
The test failure doesn't seem related to my change, and I can't seem to reproduce it locally, so I think it might be a flake. /retest |
@sarahhodne: 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. |
/ok-to-test |
Agreed. If it fails again I'll take a closer look. |
Looks like it was a flake, so opened a ticket to track that, since I think the bot said that in the last message (though that appears to have been deleted now): #413 |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nckturner, sarahhodne 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 |
The code currently assumes that Stat always return a
FileInfo
object,but if the file can't be
Stat
-ed (e.g. due to a permissions error),Stat
can return a nil
FileInfo
, plus an error. The error is only handled ifit's a "not exists" error, but there are other errors that can be
returned too.
This wasn't caught by the tests, since the mocked out
Stat
alwaysreturns a
FileInfo
, even when an error is returned.This commit also changes from
os.IsNotExist(err)
toerrors.Is(err, fs.ErrNotExist)
as recommended by the documentation foros.IsNotExist
.Fixes #349.