mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-04 15:58:39 +00:00
Fix for issue 7902.
Use utils.RFC3339NanoFixed ("2006-01-02T15:04:05.000000000Z07:00")
instead of time.RFC3339Nano to format our log timestamps - this way
things are aligned, in particular the nano seconds are padded with zeros
Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
||||
// This used to work, it test a log of PageSize-1 (gh#4851)
|
||||
@@ -102,10 +104,13 @@ func TestLogsTimestamps(t *testing.T) {
|
||||
|
||||
for _, l := range lines {
|
||||
if l != "" {
|
||||
_, err := time.Parse(time.RFC3339Nano+" ", ts.FindString(l))
|
||||
_, err := time.Parse(utils.RFC3339NanoFixed+" ", ts.FindString(l))
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to parse timestamp from %v: %v", l, err)
|
||||
}
|
||||
if l[29] != 'Z' { // ensure we have padded 0's
|
||||
t.Fatalf("Timestamp isn't padded properly: %s", l)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user