Skip to content
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

Merged
merged 1 commit into from Feb 22, 2018
Merged

Conversation

MorrisLaw
Copy link
Member

@MorrisLaw MorrisLaw commented Dec 23, 2017

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 both test/e2e and test/e2e_node, finding the newline redundancies in calls to Logf() and removing them.

Which issue(s) this PR fixes:
Fixes #57102

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Dec 23, 2017
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Dec 23, 2017
@dims
Copy link
Member

dims commented Dec 24, 2017

/ok-to-test
/release-label-none

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 24, 2017
@@ -259,6 +259,7 @@ func nowStamp() string {
}

func log(level string, format string, args ...interface{}) {
strings.TrimSuffix(format, "\n")
Copy link
Member

@ncdc ncdc Jan 2, 2018

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.

Copy link
Member

@timothysc timothysc Jan 2, 2018

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.

Copy link
Member

@ncdc ncdc Jan 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

@MorrisLaw MorrisLaw Jan 4, 2018

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! 😄

Copy link
Member

@ncdc ncdc Jan 4, 2018

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.

Copy link
Member Author

@MorrisLaw MorrisLaw Jan 4, 2018

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!

@@ -259,6 +259,7 @@ func nowStamp() string {
}

func log(level string, format string, args ...interface{}) {
strings.TrimSuffix(format, "\n")
Copy link
Member

@timothysc timothysc Jan 2, 2018

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.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 5, 2018
timothysc
timothysc previously requested changes Jan 5, 2018
Copy link
Member

@timothysc timothysc left a comment

Please squash your commits.

Also, I'm not certain all the newlines are redundant in your removal, some appear to be separators on purpose.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 14, 2018
@MorrisLaw
Copy link
Member Author

MorrisLaw commented Feb 14, 2018

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

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 18, 2018
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 18, 2018
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 18, 2018
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Feb 18, 2018

@MorrisLaw: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-gke-gci 8896103 link /test pull-kubernetes-e2e-gke-gci
pull-kubernetes-cross 510238e48bd1483dfec4c4e75a15a7604deb6580 link /test pull-kubernetes-cross
pull-kubernetes-e2e-gke 510238e48bd1483dfec4c4e75a15a7604deb6580 link /test pull-kubernetes-e2e-gke

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.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 18, 2018
@timothysc timothysc dismissed their stale review Feb 21, 2018

out-of-date

@timothysc timothysc added ok-to-merge and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Feb 21, 2018
Copy link
Member

@timothysc timothysc left a comment

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2018
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Feb 21, 2018

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 21, 2018
@k8s-github-robot
Copy link
Contributor

k8s-github-robot commented Feb 22, 2018

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.

@k8s-github-robot k8s-github-robot merged commit 714b19e into kubernetes:master Feb 22, 2018
13 checks passed
@MorrisLaw MorrisLaw deleted the bugfix/logf-newline branch Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E2E: Logf() always adding a newline to the message
7 participants