Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit d2c7d5b

Browse files
committed
[integration-test] add delay to some test case
1 parent ad38bc0 commit d2c7d5b

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

integration-cli/hyper_cli_logs_test.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ func (s *DockerSuite) TestCliLogsTimestamps(c *check.C) {
6969
testLen := 100
7070
pullImageIfNotExist("busybox")
7171
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
72+
time.Sleep(5 * time.Second)
7273

7374
id := strings.TrimSpace(out)
7475
dockerCmd(c, "stop", id)
76+
time.Sleep(5 * time.Second)
7577

7678
out, _ = dockerCmd(c, "logs", "-t", id)
7779

@@ -99,9 +101,11 @@ func (s *DockerSuite) TestCliLogsSeparateStderr(c *check.C) {
99101
pullImageIfNotExist("busybox")
100102
msg := "stderr_log"
101103
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
104+
time.Sleep(5 * time.Second)
102105

103106
id := strings.TrimSpace(out)
104107
dockerCmd(c, "stop", id)
108+
time.Sleep(5 * time.Second)
105109

106110
stdout, stderr, _ := dockerCmdWithStdoutStderr(c, "logs", id)
107111

@@ -120,9 +124,11 @@ func (s *DockerSuite) TestCliLogsStderrInStdout(c *check.C) {
120124
pullImageIfNotExist("busybox")
121125
msg := "stderr_log"
122126
out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
127+
time.Sleep(5 * time.Second)
123128

124129
id := strings.TrimSpace(out)
125130
dockerCmd(c, "stop", id)
131+
time.Sleep(5 * time.Second)
126132

127133
stdout, stderr, _ := dockerCmdWithStdoutStderr(c, "logs", id)
128134
c.Assert(stderr, checker.Equals, "")
@@ -139,9 +145,11 @@ func (s *DockerSuite) TestCliLogsTail(c *check.C) {
139145
testLen := 100
140146
pullImageIfNotExist("busybox")
141147
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
148+
time.Sleep(5 * time.Second)
142149

143150
id := strings.TrimSpace(out)
144151
dockerCmd(c, "stop", id)
152+
time.Sleep(5 * time.Second)
145153

146154
out, _ = dockerCmd(c, "logs", "--tail", "5", id)
147155

@@ -169,9 +177,11 @@ func (s *DockerSuite) TestCliLogsFollowStopped(c *check.C) {
169177
testRequires(c, DaemonIsLinux)
170178
pullImageIfNotExist("busybox")
171179
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
180+
time.Sleep(5 * time.Second)
172181

173182
id := strings.TrimSpace(out)
174183
dockerCmd(c, "stop", id)
184+
time.Sleep(5 * time.Second)
175185

176186
logsCmd := exec.Command(dockerBinary, "logs", "-f", id)
177187
c.Assert(logsCmd.Start(), checker.IsNil)
@@ -199,6 +209,7 @@ func (s *DockerSuite) TestCliLogsSince(c *check.C) {
199209
name := "testlogssince"
200210
dockerCmd(c, "run", "--name="+name, "-d", "busybox", "/bin/sh", "-c", "for i in $(seq 1 30); do sleep 2; echo log$i; done")
201211
time.Sleep(5*time.Second)
212+
202213
out, _ := dockerCmd(c, "logs", "-t", name)
203214

204215
log2Line := strings.Split(strings.Split(out, "\n")[1], " ")
@@ -238,6 +249,7 @@ func (s *DockerSuite) TestCliLogsSinceFutureFollow(c *check.C) {
238249
testRequires(c, DaemonIsLinux)
239250
pullImageIfNotExist("busybox")
240251
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `for i in $(seq 1 50); do date +%s; sleep 1; done`)
252+
time.Sleep(5 * time.Second)
241253
id := strings.TrimSpace(out)
242254

243255
now := daemonTime(c).Unix()
@@ -260,13 +272,14 @@ func (s *DockerSuite) TestCliLogsFollowSlowStdoutConsumer(c *check.C) {
260272
testRequires(c, DaemonIsLinux)
261273
pullImageIfNotExist("busybox")
262274
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 600000;yes X | head -c 200000`)
263-
275+
time.Sleep(5 * time.Second)
264276
id := strings.TrimSpace(out)
265277

266278
stopSlowRead := make(chan bool)
267279

268280
go func() {
269281
exec.Command(dockerBinary, "stop", id).Run()
282+
time.Sleep(5 * time.Second)
270283
stopSlowRead <- true
271284
}()
272285

integration-cli/hyper_cli_restart_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ func (s *DockerSuite) TestCliRestartStoppedContainer(c *check.C) {
1616
testRequires(c, DaemonIsLinux)
1717
pullImageIfNotExist("busybox")
1818
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "foobar")
19-
19+
time.Sleep(5 * time.Second)
2020
cleanedContainerID := strings.TrimSpace(out)
2121
c.Assert(waitExited(cleanedContainerID, 30*time.Second), checker.IsNil)
2222

2323
out, _ = dockerCmd(c, "logs", cleanedContainerID)
2424
c.Assert(out, checker.Equals, "foobar\n")
2525

2626
dockerCmd(c, "restart", cleanedContainerID)
27+
time.Sleep(5 * time.Second)
2728

2829
out, _ = dockerCmd(c, "logs", cleanedContainerID)
2930
c.Assert(out, checker.Equals, "foobar\n")
@@ -35,7 +36,7 @@ func (s *DockerSuite) TestCliRestartRunningContainer(c *check.C) {
3536
testRequires(c, DaemonIsLinux)
3637
pullImageIfNotExist("busybox")
3738
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "echo foobar && sleep 30 && echo 'should not print this'")
38-
39+
time.Sleep(5 * time.Second)
3940
cleanedContainerID := strings.TrimSpace(out)
4041

4142
c.Assert(waitRun(cleanedContainerID), checker.IsNil)
@@ -44,6 +45,7 @@ func (s *DockerSuite) TestCliRestartRunningContainer(c *check.C) {
4445
c.Assert(out, checker.Equals, "foobar\n")
4546

4647
dockerCmd(c, "restart", "-t", "1", cleanedContainerID)
48+
time.Sleep(5 * time.Second)
4749

4850
out, _ = dockerCmd(c, "logs", cleanedContainerID)
4951

integration-cli/hyper_cli_run_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,14 @@ func (s *DockerSuite) TestCliRunDetachedContainerIDPrinting(c *check.C) {
127127
defer printTestDuration(time.Now())
128128
pullImageIfNotExist("busybox")
129129
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
130+
time.Sleep(5 * time.Second)
130131

131132
out = strings.TrimSpace(out)
132133
dockerCmd(c, "stop", out)
134+
time.Sleep(5 * time.Second)
133135

134136
rmOut, _ := dockerCmd(c, "rm", out)
137+
time.Sleep(5 * time.Second)
135138

136139
rmOut = strings.TrimSpace(rmOut)
137140
if rmOut != out {
@@ -995,6 +998,7 @@ func (s *DockerSuite) TestCliRunUnknownCommand(c *check.C) {
995998

996999
cID := strings.TrimSpace(out)
9971000
_, _, err := dockerCmdWithError("start", cID)
1001+
time.Sleep(5 * time.Second)
9981002

9991003
// Windows and Linux are different here by architectural design. Linux will
10001004
// fail to start the container, so an error is expected. Windows will
@@ -1107,7 +1111,7 @@ func (s *DockerSuite) TestCliRunRestartMaxRetries(c *check.C) {
11071111
defer printTestDuration(time.Now())
11081112
pullImageIfNotExist("busybox")
11091113
out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "sh", "-c", "sleep 15; false")
1110-
timeout := 60 * time.Second
1114+
timeout := 90 * time.Second
11111115
if daemonPlatform == "windows" {
11121116
timeout = 45 * time.Second
11131117
}

0 commit comments

Comments
 (0)