Skip to content

Commit

Permalink
logger: Fix nanosecond timestamp test
Browse files Browse the repository at this point in the history
`TestNewSystemLogHook()` checks to ensure a nanonsecond timestamp is
generated. However, the `time.RFC3339Nano` time format truncates
trailing zeros meaning a nanosecond timestamp won't always have nine
digits.

Fixes clearcontainers#1017.

Signed-off-by: James O. D. Hunt <[email protected]>
  • Loading branch information
jodh-intel committed Feb 21, 2018
1 parent bb0d5d7 commit 702ee56
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ func TestNewSystemLogHook(t *testing.T) {
`\d{2}:\d{2}:\d{2}` +
// high-precision separator
`.` +
// nano-seconds
`\d{9}` +
// nano-seconds. Note that the quantifier range is
// required because the time.RFC3339Nano format
// trunctates trailing zeros.
`\d{1,9}` +
// UTC timezone specifier
`Z`

Expand Down

0 comments on commit 702ee56

Please sign in to comment.