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:
Doug Davis
2014-09-16 10:28:37 -07:00
parent 25f7840993
commit cd7a5f5c09
6 changed files with 20 additions and 7 deletions
+6 -1
View File
@@ -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)
}
}
}