mirror of https://github.com/docker/docs.git
Merge pull request #21134 from tophj-ibm/fix-logtest-on-empty-log
Fix error-checking when looking at empty log
This commit is contained in:
commit
93e04e705a
|
@ -218,8 +218,8 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
|
||||||
|
|
||||||
since := t.Unix() + 2
|
since := t.Unix() + 2
|
||||||
out, _ = dockerCmd(c, "logs", "-t", "-f", fmt.Sprintf("--since=%v", since), name)
|
out, _ = dockerCmd(c, "logs", "-t", "-f", fmt.Sprintf("--since=%v", since), name)
|
||||||
|
c.Assert(out, checker.Not(checker.HasLen), 0, check.Commentf("cannot read from empty log"))
|
||||||
lines := strings.Split(strings.TrimSpace(out), "\n")
|
lines := strings.Split(strings.TrimSpace(out), "\n")
|
||||||
c.Assert(lines, checker.Not(checker.HasLen), 0)
|
|
||||||
for _, v := range lines {
|
for _, v := range lines {
|
||||||
ts, err := time.Parse(time.RFC3339Nano, strings.Split(v, " ")[0])
|
ts, err := time.Parse(time.RFC3339Nano, strings.Split(v, " ")[0])
|
||||||
c.Assert(err, checker.IsNil, check.Commentf("cannot parse timestamp output from log: '%v'", v))
|
c.Assert(err, checker.IsNil, check.Commentf("cannot parse timestamp output from log: '%v'", v))
|
||||||
|
|
Loading…
Reference in New Issue