|
@@ -8,6 +8,7 @@ import (
|
|
|
"strings"
|
|
|
"time"
|
|
|
|
|
|
+ "github.com/docker/docker/pkg/integration/checker"
|
|
|
"github.com/go-check/check"
|
|
|
)
|
|
|
|
|
@@ -15,7 +16,7 @@ func (s *DockerSuite) TestLogsApiWithStdout(c *check.C) {
|
|
|
testRequires(c, DaemonIsLinux)
|
|
|
out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 1; done")
|
|
|
id := strings.TrimSpace(out)
|
|
|
- c.Assert(waitRun(id), check.IsNil)
|
|
|
+ c.Assert(waitRun(id), checker.IsNil)
|
|
|
|
|
|
type logOut struct {
|
|
|
out string
|
|
@@ -41,8 +42,8 @@ func (s *DockerSuite) TestLogsApiWithStdout(c *check.C) {
|
|
|
|
|
|
select {
|
|
|
case l := <-chLog:
|
|
|
- c.Assert(l.err, check.IsNil)
|
|
|
- c.Assert(l.res.StatusCode, check.Equals, http.StatusOK)
|
|
|
+ c.Assert(l.err, checker.IsNil)
|
|
|
+ c.Assert(l.res.StatusCode, checker.Equals, http.StatusOK)
|
|
|
if !strings.HasSuffix(l.out, "hello") {
|
|
|
c.Fatalf("expected log output to container 'hello', but it does not")
|
|
|
}
|
|
@@ -57,8 +58,8 @@ func (s *DockerSuite) TestLogsApiNoStdoutNorStderr(c *check.C) {
|
|
|
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
|
|
|
|
|
status, body, err := sockRequest("GET", fmt.Sprintf("/containers/%s/logs", name), nil)
|
|
|
- c.Assert(status, check.Equals, http.StatusBadRequest)
|
|
|
- c.Assert(err, check.IsNil)
|
|
|
+ c.Assert(status, checker.Equals, http.StatusBadRequest)
|
|
|
+ c.Assert(err, checker.IsNil)
|
|
|
|
|
|
expected := "Bad parameters: you must choose at least one stream"
|
|
|
if !bytes.Contains(body, []byte(expected)) {
|
|
@@ -75,7 +76,7 @@ func (s *DockerSuite) TestLogsApiFollowEmptyOutput(c *check.C) {
|
|
|
|
|
|
_, body, err := sockRequestRaw("GET", fmt.Sprintf("/containers/%s/logs?follow=1&stdout=1&stderr=1&tail=all", name), bytes.NewBuffer(nil), "")
|
|
|
t1 := time.Now()
|
|
|
- c.Assert(err, check.IsNil)
|
|
|
+ c.Assert(err, checker.IsNil)
|
|
|
body.Close()
|
|
|
elapsed := t1.Sub(t0).Seconds()
|
|
|
if elapsed > 5.0 {
|
|
@@ -86,6 +87,6 @@ func (s *DockerSuite) TestLogsApiFollowEmptyOutput(c *check.C) {
|
|
|
func (s *DockerSuite) TestLogsAPIContainerNotFound(c *check.C) {
|
|
|
name := "nonExistentContainer"
|
|
|
resp, _, err := sockRequestRaw("GET", fmt.Sprintf("/containers/%s/logs?follow=1&stdout=1&stderr=1&tail=all", name), bytes.NewBuffer(nil), "")
|
|
|
- c.Assert(err, check.IsNil)
|
|
|
- c.Assert(resp.StatusCode, check.Equals, http.StatusNotFound)
|
|
|
+ c.Assert(err, checker.IsNil)
|
|
|
+ c.Assert(resp.StatusCode, checker.Equals, http.StatusNotFound)
|
|
|
}
|