1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Prevent potential panic in TestLogsAPIUntil

Seen failing on Windows:

    22:27:52 ----------------------------------------------------------------------
    22:27:52 PANIC: docker_api_logs_test.go:152: DockerSuite.TestLogsAPIUntil
    22:27:52
    22:27:52 ... Panic: runtime error: index out of range (PC=0x45AC01)
    22:27:52
    22:27:52 d:/CI/CI-7caa30e89/go/src/runtime/asm_amd64.s:509
    22:27:52   in call32
    22:27:52 d:/CI/CI-7caa30e89/go/src/runtime/panic.go:491
    22:27:52   in gopanic
    22:27:52 d:/CI/CI-7caa30e89/go/src/runtime/panic.go:28
    22:27:52   in panicindex
    22:27:52 docker_api_logs_test.go:175
    22:27:52   in DockerSuite.TestLogsAPIUntil
    22:27:52 d:/CI/CI-7caa30e89/go/src/runtime/asm_amd64.s:509
    22:27:52   in call32
    22:27:52 d:/CI/CI-7caa30e89/go/src/reflect/value.go:434
    22:27:52   in Value.call
    22:27:52 d:/CI/CI-7caa30e89/go/src/reflect/value.go:302
    22:27:52   in Value.Call
    22:27:52 c:/gopath/src/github.com/docker/docker/vendor/github.com/go-check/check/check.go:816
    22:27:52   in suiteRunner.forkTest.func1
    22:27:52 c:/gopath/src/github.com/docker/docker/vendor/github.com/go-check/check/check.go:672
    22:27:52   in suiteRunner.forkCall.func1
    22:27:52 d:/CI/CI-7caa30e89/go/src/runtime/asm_amd64.s:2337
    22:27:52   in goexit
    22:27:54
    22:27:54 ----------------------------------------------------------------------

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2017-12-14 23:20:44 -08:00
parent 1cea9d3bdb
commit e77de7856b
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -172,6 +172,8 @@ func (s *DockerSuite) TestLogsAPIUntil(c *check.C) {
// Get timestamp of second log line // Get timestamp of second log line
allLogs := extractBody(c, types.ContainerLogsOptions{Timestamps: true, ShowStdout: true}) allLogs := extractBody(c, types.ContainerLogsOptions{Timestamps: true, ShowStdout: true})
c.Assert(len(allLogs), checker.GreaterOrEqualThan, 3)
t, err := time.Parse(time.RFC3339Nano, strings.Split(allLogs[1], " ")[0]) t, err := time.Parse(time.RFC3339Nano, strings.Split(allLogs[1], " ")[0])
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
until := t.Format(time.RFC3339Nano) until := t.Format(time.RFC3339Nano)