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
Bugfix/logf newline #57583
Bugfix/logf newline #57583
Conversation
/ok-to-test |
test/e2e/framework/util.go
Outdated
@@ -259,6 +259,7 @@ func nowStamp() string { | |||
} | |||
|
|||
func log(level string, format string, args ...interface{}) { | |||
strings.TrimSuffix(format, "\n") |
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 doesn't mutate format
, but instead returns a new string
with the suffix trimmed. You'll need to pass the returned value to fmt.Fprintf
.
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.
Also, we shouldn't trim, vs. find and fix offenders in the logs.
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.
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.
@timothysc can you clarify "find and fix offenders in the logs", I want to make sure I completely understand your review suggestion. Thank you!
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.
He means we should go through all the e2e code and remove any trailing newlines from log statements.
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.
Thank you for the clarification @ncdc!
test/e2e/framework/util.go
Outdated
@@ -259,6 +259,7 @@ func nowStamp() string { | |||
} | |||
|
|||
func log(level string, format string, args ...interface{}) { | |||
strings.TrimSuffix(format, "\n") |
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.
Also, we shouldn't trim, vs. find and fix offenders in the logs.
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.
Please squash your commits.
Also, I'm not certain all the newlines are redundant in your removal, some appear to be separators on purpose.
I've been pretty busy this past month. But I'm going to get working on this again. I'll be updating the PR soon, with your recommendations. Thank you @timothysc |
e1b5efe
to
683f4ea
Compare
683f4ea
to
510238e
Compare
@MorrisLaw: The following tests 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. |
510238e
to
e724886
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MorrisLaw, timothysc 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 |
Automatic merge from submit-queue (batch tested with PRs 60158, 60156, 58111, 57583, 60055). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
Removes all redundant new lines being passed into the
Logf()
function. This involved going through code in bothtest/e2e
andtest/e2e_node
, finding the newline redundancies in calls toLogf()
and removing them.Which issue(s) this PR fixes:
Fixes #57102
Release note: