-
Notifications
You must be signed in to change notification settings - Fork 105
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
After setup error, do klog.Error not klog.Fatal, and move on #362
After setup error, do klog.Error not klog.Fatal, and move on #362
Conversation
|
Welcome @codegold79! |
Hi @codegold79. 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. |
I'm thinking about how to write a test that ensures finish/clean up steps happen after setup step fails. This PR will be a WIP until I can get some tests up. |
43c5dab
to
f32d9a0
Compare
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.
/ok-to-test
eb18dd1
to
84903fa
Compare
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.
HI @codegold79 thanks for taking on this. This is a good start, I left some comments about the structure of your test.
@codegold79 apologies for the delay. |
84903fa
to
5541857
Compare
Thanks, @vladimirvivien! I responded to your first review comment and tried to explain why I had to make a separate example and use As for your second review comment, I made the change as you suggested. I also got rid of the dummy test, as it doesn't help anything except to not trigger a warning that there are no tests. The thing is, I'm not testing any features, I'm making sure the final actions complete even after a panic in the setup, before any feature tests happen. PR is ready for review again. |
@codegold79 (apologies for the late reply) /lgtm |
Hi @codegold79 can you please squash commits. Thanks. |
When an error happens during a setup step, instead of calling klog.Fatal which causes os.Exit, instead do klog.Error, break, run defer function with clean up steps, and return. Include setup fail test example in examples directory. Signed-off-by: F. Gold <fgold@vmware.com>
6c768f2
to
70b0316
Compare
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.
thanks
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: codegold79, cpanato 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 |
When an error happens during a setup step, instead of calling
klog.Fatal
which causesos.Exit
, instead doklog.Error
,break
, rundefer
function with clean up steps, andreturn
.What type of PR is this?
/kind bug
What this PR does / why we need it:
I found this line to be the problem as to why our KinD cluster deletion was not happening as intended. As soon as an error value is passed during a setup step,
klog.Fatalf(...)
is called:According to klog docs,
To reiterate,
klog.Fatal
is stopping all operations and exiting program withos.Exit
. This is not the behavior I want. What I want to happen is for the setup range loop to stop trying to do the setup steps, and try to get to the function return,return m.Run()
. However, before returning, I expect the defer block to run next where the finishing steps, like cluster cleanup, happen.Which issue(s) this PR fixes:
Fixes #188
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., Usage docs, etc.: