-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 for humanize time in #5005 #5079
Fix for humanize time in #5005 #5079
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5079 +/- ##
==========================================
+ Coverage 71.82% 71.84% +0.01%
==========================================
Files 387 387
Lines 13928 13943 +15
==========================================
+ Hits 10004 10017 +13
- Misses 3190 3191 +1
- Partials 734 735 +1
Continue to review full report at Codecov.
|
cba6b42
to
a2703c5
Compare
Thanks a lot @gunadhya for your PR. can you please show the change output and how the new line looks? Also, can you please switch to human readable time elsewhere https://github.com/GoogleContainerTools/skaffold/search?q=time.Since%28start%29 Thanks |
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 a lot @gunadhya for your PR.
can you please show the change output and how the new line looks?
Also, can you please switch to human readable time elsewhere https://github.com/GoogleContainerTools/skaffold/search?q=time.Since%28start%29
Thanks
Tejal
Hi @tejal29, So the output would look something like this : |
Thanks!
yes please. |
I've made the changes as requested. Please do let me know if anything else seems broken or need fixing. |
integration/skaffold/helper.go
Outdated
if time.Since(start).Seconds() < 1 { | ||
showsTime = time.Since(start).String() + " ago" | ||
} | ||
logrus.Infoln("Ran", showsTime) |
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 would make an excellent utility function so you don't have to repeat the code.
if time.Since(start).Seconds() < 1 { | |
showsTime = time.Since(start).String() + " ago" | |
} | |
logrus.Infoln("Ran", showsTime) | |
logrus.Infoln("Ran", util.showHumanizeTime(start)) |
and
def showHumanizeTime(start time.Time) string {
showsTime := humanize.Time(start)
if time.Since(start).Seconds() < 1 {
return time.Since(start).String() + " ago"
}
return humanize.Time(start)
}
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.
I've added a function in util and reworked its usage in the files.
I'm not sure why this test is failing? https://travis-ci.com/github/GoogleContainerTools/skaffold/jobs/464991267#L1013 |
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.
Everything looks good, just some changes to the test should be made.
Fixes: #5005
Related: Relevant tracking issues, for context
Merge before/after: Dependent or prerequisite PRs
Description
Added go-humanize
I couldn't figure out how to get milliseconds values in the go-humanize library so created a workaround for that.
User facing changes (remove if N/A)
Format for printing output here
Follow-up Work (remove if N/A)