mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows CI: Port docker_cli_logs_test.go
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
a7fefcf16c
commit
10bd587d77
1 changed files with 6 additions and 12 deletions
|
@ -16,7 +16,6 @@ import (
|
|||
|
||||
// This used to work, it test a log of PageSize-1 (gh#4851)
|
||||
func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testLen := 32767
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
|
||||
|
||||
|
@ -30,7 +29,6 @@ func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *check.C) {
|
|||
|
||||
// Regression test: When going over the PageSize, it used to panic (gh#4851)
|
||||
func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testLen := 32768
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
|
||||
|
||||
|
@ -44,7 +42,6 @@ func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *check.C) {
|
|||
|
||||
// Regression test: When going much over the PageSize, it used to block (gh#4851)
|
||||
func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testLen := 33000
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
|
||||
|
||||
|
@ -57,7 +54,6 @@ func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testLen := 100
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
|
||||
|
||||
|
@ -83,7 +79,6 @@ func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
msg := "stderr_log"
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
|
||||
|
||||
|
@ -100,6 +95,8 @@ func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsStderrInStdout(c *check.C) {
|
||||
// TODO Windows: Needs investigation why this fails. Obtained string includes
|
||||
// a bunch of ANSI escape sequences before the "stderr_log" message.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
msg := "stderr_log"
|
||||
out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
|
||||
|
@ -115,7 +112,6 @@ func (s *DockerSuite) TestLogsStderrInStdout(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsTail(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testLen := 100
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
|
||||
|
||||
|
@ -142,7 +138,6 @@ func (s *DockerSuite) TestLogsTail(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -160,13 +155,12 @@ func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
|
|||
select {
|
||||
case err := <-errChan:
|
||||
c.Assert(err, checker.IsNil)
|
||||
case <-time.After(1 * time.Second):
|
||||
case <-time.After(30 * time.Second):
|
||||
c.Fatal("Following logs is hanged")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsSince(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testlogssince"
|
||||
dockerCmd(c, "run", "--name="+name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do sleep 2; echo log$i; done")
|
||||
out, _ := dockerCmd(c, "logs", "-t", name)
|
||||
|
@ -202,6 +196,7 @@ func (s *DockerSuite) TestLogsSince(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
|
||||
// TODO Windows: Flakey on TP4. Enable for next technical preview.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testlogssincefuturefollow"
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", `for i in $(seq 1 5); do echo log$i; sleep 1; done`)
|
||||
|
@ -210,7 +205,7 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
|
|||
// our `--since` argument. Because the log producer runs in the background,
|
||||
// we need to check repeatedly for some output to be produced.
|
||||
var timestamp string
|
||||
for i := 0; i != 5 && timestamp == ""; i++ {
|
||||
for i := 0; i != 100 && timestamp == ""; i++ {
|
||||
if out, _ = dockerCmd(c, "logs", "-t", name); out == "" {
|
||||
time.Sleep(time.Millisecond * 100) // Retry
|
||||
} else {
|
||||
|
@ -235,6 +230,7 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
|
|||
|
||||
// Regression test for #8832
|
||||
func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
|
||||
// TODO Windows: Consider enabling post-TP4. Too expensive to run on TP4
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 600000;yes X | head -c 200000`)
|
||||
|
||||
|
@ -266,7 +262,6 @@ func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 2; done")
|
||||
id := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(id), checker.IsNil)
|
||||
|
@ -318,7 +313,6 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do sleep 2; done")
|
||||
id := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(id), checker.IsNil)
|
||||
|
|
Loading…
Reference in a new issue