Merge lp:~rogpeppe/gocheck/monotonic-time-stamps into lp:gocheck
Status: | Merged |
---|---|
Merged at revision: | 87 |
Proposed branch: | lp:~rogpeppe/gocheck/monotonic-time-stamps |
Merge into: | lp: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:~rogpeppe/gocheck/monotonic-time-stamps |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gustavo Niemeyer | Pending | ||
Review via email: mp+98841@code.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-
[LOG] 78.46405 JUJU state: waiting for state to be initialized
destroy env
[LOG] 13.73135 JUJU environs/ec2: destroying environment "sample-
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-
[LOG] 0:00.571 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
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: 20-157- 185.compute- 1.amazonaws. com:2181" ] 6326978ae364745 5"
["ec2-23-
[LOG] 78.46405 JUJU state: waiting for state to be initialized
destroy env
[LOG] 13.73135 JUJU environs/ec2: destroying environment
"sample-
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 92839ff36fe291d d" 92839ff36fe291d d"
"sample-
[LOG] 7.273315s JUJU environs/ec2: started instance "i-69f7a10d"
[LOG] 14.822193s JUJU environs/ec2: bootstrapping environment
"sample-
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 ( net/gocheck"
+ "fmt"
"launchpad.
"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 test.go'
=== modified file 'foundation_
--- 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 ( net/gocheck"
+ "fmt"
"launchpad.
- "strings"
- "regexp"
- "fmt"
"log"
"os"
+ "regexp"
+ "strings"
)
// ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- - \.[0-9] +)?[mun] ?s +Hello there\n` MatchString( expected, output)
@@ -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]+(
output := c.GetTestLog()
- matched, err := regexp.
- if err != nil {
- c.Error("Bad expression: ", expected)
- } else if !matched {
- c.Error("Out...