Merge lp://qastaging/~rogpeppe/gocheck/monotonic-time-stamps into lp://qastaging/gocheck

Proposed by Roger Peppe
Status: Merged
Merged at revision: 87
Proposed branch: lp://qastaging/~rogpeppe/gocheck/monotonic-time-stamps
Merge into: lp://qastaging/gocheck
Diff against target: 207 lines (+38/-40)
8 files modified
benchmark_test.go (+6/-6)
bootstrap_test.go (+1/-1)
foundation_test.go (+2/-7)
gocheck.go (+10/-9)
gocheck_test.go (+7/-7)
helpers.go (+6/-3)
run.go (+5/-5)
run_test.go (+1/-2)
To merge this branch: bzr merge lp://qastaging/~rogpeppe/gocheck/monotonic-time-stamps
Reviewer Review Type Date Requested Status
Gustavo Niemeyer Pending
Review via email: mp+98841@code.qastaging.launchpad.net

Description of the change

Use readable time stamps on log messages.

On long running tests, the time might wrap:

[LOG] 72.15087 JUJU state: opening state; zookeeper addresses: ["ec2-23-20-157-185.compute-1.amazonaws.com:2181"]
[LOG] 78.46405 JUJU state: waiting for state to be initialized
destroy env
[LOG] 13.73135 JUJU environs/ec2: destroying environment "sample-6326978ae3647455"

This CL makes the time stamp format as a duration since
the start of the test in the format agreed before:

[LOG] 0:00.568 DEBUG juju.environs.tools reading v1.* tools
[LOG] 0:00.569 INFO juju environs/testing: uploading FAKE tools 1.17.3-trusty-amd64
[LOG] 0:00.570 INFO juju environs/testing: uploading FAKE tools 1.17.3-precise-amd64
[LOG] 0:00.571 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any

https://codereview.appspot.com/5874049/

To post a comment you must log in.
Revision history for this message
Roger Peppe (rogpeppe) wrote :
Download full text (7.5 KiB)

Reviewers: mp+98841_code.launchpad.net,

Message:
Please take a look.

Description:
use readable time stamps on log messages.

On long running tests, I was seeing log output like this:

[LOG] 72.15087 JUJU state: opening state; zookeeper addresses:
["ec2-23-20-157-185.compute-1.amazonaws.com:2181"]
[LOG] 78.46405 JUJU state: waiting for state to be initialized
destroy env
[LOG] 13.73135 JUJU environs/ec2: destroying environment
"sample-6326978ae3647455"

This CL makes the time stamp format as a duration
since the start of the test. For instance:

[LOG] 139us JUJU environs/ec2: bootstrapping environment
"sample-92839ff36fe291dd"
[LOG] 7.273315s JUJU environs/ec2: started instance "i-69f7a10d"
[LOG] 14.822193s JUJU environs/ec2: bootstrapping environment
"sample-92839ff36fe291dd"

For consideration: we could also round to milliseconds (nanosecond time
stamps are rarely useful in logs).

https://code.launchpad.net/~rogpeppe/gocheck/monotonic-time-stamps/+merge/98841

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/5874049/

Affected files:
   A [revision details]
   M bootstrap_test.go
   M checkers.go
   M foundation_test.go
   M gocheck.go
   M gocheck_test.go
   M helpers.go
   M helpers_test.go
   M run.go
   M run_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: bootstrap_test.go
=== modified file 'bootstrap_test.go'
--- bootstrap_test.go 2011-11-08 15:09:50 +0000
+++ bootstrap_test.go 2012-03-22 13:59:07 +0000
@@ -13,9 +13,9 @@
  package gocheck_test

  import (
+ "fmt"
   "launchpad.net/gocheck"
   "strings"
- "fmt"
  )

  type BootstrapS struct{}

Index: checkers.go
=== modified file 'checkers.go'
--- checkers.go 2012-02-25 19:01:16 +0000
+++ checkers.go 2012-03-22 13:59:07 +0000
@@ -1,9 +1,9 @@
  package gocheck

  import (
+ "fmt"
   "reflect"
   "regexp"
- "fmt"
  )

  // -----------------------------------------------------------------------
@@ -238,7 +238,6 @@
   return value.Len() == n, ""
  }

-
  // -----------------------------------------------------------------------
  // ErrorMatches checker.

Index: foundation_test.go
=== modified file 'foundation_test.go'
--- foundation_test.go 2012-02-25 16:58:37 +0000
+++ foundation_test.go 2012-03-22 13:59:07 +0000
@@ -7,12 +7,12 @@
  package gocheck_test

  import (
+ "fmt"
   "launchpad.net/gocheck"
- "strings"
- "regexp"
- "fmt"
   "log"
   "os"
+ "regexp"
+ "strings"
  )

  // -----------------------------------------------------------------------
@@ -301,14 +301,9 @@
   logger = log.New(os.Stderr, "", 0)
   logger = c
   logger.Output(0, "Hello there")
- expected := "\\[LOG\\] [.0-9]+ Hello there\n"
+ expected := `\[LOG\] [0-9]+(\.[0-9]+)?[mun]?s +Hello there\n`
   output := c.GetTestLog()
- matched, err := regexp.MatchString(expected, output)
- if err != nil {
- c.Error("Bad expression: ", expected)
- } else if !matched {
- c.Error("Out...

Read more...

Revision history for this message
Roger Peppe (rogpeppe) wrote :
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

This has already been fixed in the last release, following up a
conversation we had online and a format we both agreed with.

https://codereview.appspot.com/5874049/

Revision history for this message
Roger Peppe (rogpeppe) wrote :
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches