-
Notifications
You must be signed in to change notification settings - Fork 214
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
test: cleanup temporary file #205
Conversation
Welcome @zhijianli88! |
klog_test.go
Outdated
@@ -567,6 +567,7 @@ func TestOpenAppendOnStart(t *testing.T) { | |||
if !strings.Contains(string(b), x) { | |||
t.Fatalf("got %s, missing expected Info log: %s", string(b), x) | |||
} | |||
os.Remove(f.Name()) |
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.
can this be:
defer os.Remove..
after this:
f, err := ioutil.TempFile("", "test_klog_OpenAppendOnStart")
if err != nil {
..
}
// < --- add here
?
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.
My initial thought was as your suggestion, but i guess it would be better that we can get some hints from this temproary log file when test failed
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.
it's better to always remove it, otherwise the test is leaking files on disk.
if the test is failing the developer can comment the line to debug.
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, updated
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.
/triage accepted
/priority backlog
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
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
thanks.
someone should approve after that.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, neolit123, zhijianli88 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 |
Signed-off-by: Li Zhijian lizhijian@cn.fujitsu.com
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
Release note: