Browse code

Windows CI: Port docker_cli_logs_test.go

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/02/25 07:26:08
Showing 1 changed files
... ...
@@ -16,7 +16,6 @@ import (
16 16
 
17 17
 // This used to work, it test a log of PageSize-1 (gh#4851)
18 18
 func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *check.C) {
19
-	testRequires(c, DaemonIsLinux)
20 19
 	testLen := 32767
21 20
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
22 21
 
... ...
@@ -30,7 +29,6 @@ func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *check.C) {
30 30
 
31 31
 // Regression test: When going over the PageSize, it used to panic (gh#4851)
32 32
 func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *check.C) {
33
-	testRequires(c, DaemonIsLinux)
34 33
 	testLen := 32768
35 34
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
36 35
 
... ...
@@ -44,7 +42,6 @@ func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *check.C) {
44 44
 
45 45
 // Regression test: When going much over the PageSize, it used to block (gh#4851)
46 46
 func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *check.C) {
47
-	testRequires(c, DaemonIsLinux)
48 47
 	testLen := 33000
49 48
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
50 49
 
... ...
@@ -57,7 +54,6 @@ func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *check.C) {
57 57
 }
58 58
 
59 59
 func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
60
-	testRequires(c, DaemonIsLinux)
61 60
 	testLen := 100
62 61
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
63 62
 
... ...
@@ -83,7 +79,6 @@ func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
83 83
 }
84 84
 
85 85
 func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) {
86
-	testRequires(c, DaemonIsLinux)
87 86
 	msg := "stderr_log"
88 87
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
89 88
 
... ...
@@ -100,6 +95,8 @@ func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) {
100 100
 }
101 101
 
102 102
 func (s *DockerSuite) TestLogsStderrInStdout(c *check.C) {
103
+	// TODO Windows: Needs investigation why this fails. Obtained string includes
104
+	// a bunch of ANSI escape sequences before the "stderr_log" message.
103 105
 	testRequires(c, DaemonIsLinux)
104 106
 	msg := "stderr_log"
105 107
 	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) {
115 115
 }
116 116
 
117 117
 func (s *DockerSuite) TestLogsTail(c *check.C) {
118
-	testRequires(c, DaemonIsLinux)
119 118
 	testLen := 100
120 119
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
121 120
 
... ...
@@ -142,7 +138,6 @@ func (s *DockerSuite) TestLogsTail(c *check.C) {
142 142
 }
143 143
 
144 144
 func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
145
-	testRequires(c, DaemonIsLinux)
146 145
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
147 146
 
148 147
 	id := strings.TrimSpace(out)
... ...
@@ -160,13 +155,12 @@ func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
160 160
 	select {
161 161
 	case err := <-errChan:
162 162
 		c.Assert(err, checker.IsNil)
163
-	case <-time.After(1 * time.Second):
163
+	case <-time.After(30 * time.Second):
164 164
 		c.Fatal("Following logs is hanged")
165 165
 	}
166 166
 }
167 167
 
168 168
 func (s *DockerSuite) TestLogsSince(c *check.C) {
169
-	testRequires(c, DaemonIsLinux)
170 169
 	name := "testlogssince"
171 170
 	dockerCmd(c, "run", "--name="+name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do sleep 2; echo log$i; done")
172 171
 	out, _ := dockerCmd(c, "logs", "-t", name)
... ...
@@ -202,6 +196,7 @@ func (s *DockerSuite) TestLogsSince(c *check.C) {
202 202
 }
203 203
 
204 204
 func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
205
+	// TODO Windows: Flakey on TP4. Enable for next technical preview.
205 206
 	testRequires(c, DaemonIsLinux)
206 207
 	name := "testlogssincefuturefollow"
207 208
 	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) {
210 210
 	// our `--since` argument. Because the log producer runs in the background,
211 211
 	// we need to check repeatedly for some output to be produced.
212 212
 	var timestamp string
213
-	for i := 0; i != 5 && timestamp == ""; i++ {
213
+	for i := 0; i != 100 && timestamp == ""; i++ {
214 214
 		if out, _ = dockerCmd(c, "logs", "-t", name); out == "" {
215 215
 			time.Sleep(time.Millisecond * 100) // Retry
216 216
 		} else {
... ...
@@ -235,6 +230,7 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
235 235
 
236 236
 // Regression test for #8832
237 237
 func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
238
+	// TODO Windows: Consider enabling post-TP4. Too expensive to run on TP4
238 239
 	testRequires(c, DaemonIsLinux)
239 240
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 600000;yes X | head -c 200000`)
240 241
 
... ...
@@ -266,7 +262,6 @@ func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
266 266
 }
267 267
 
268 268
 func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
269
-	testRequires(c, DaemonIsLinux)
270 269
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 2; done")
271 270
 	id := strings.TrimSpace(out)
272 271
 	c.Assert(waitRun(id), checker.IsNil)
... ...
@@ -318,7 +313,6 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
318 318
 }
319 319
 
320 320
 func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
321
-	testRequires(c, DaemonIsLinux)
322 321
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do sleep 2; done")
323 322
 	id := strings.TrimSpace(out)
324 323
 	c.Assert(waitRun(id), checker.IsNil)