Browse code

Some slight tweaks for the integration test

`arm64` needs get more time duration for the test to finish.

`pty.Start()` opens a file, so the caller should close it explicitly,
else the file I/O can result in unexpected data synchronization issue.

All those changes will not affect the test itself.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>

Dennis Chen authored on 2018/05/17 16:42:42
Showing 3 changed files
... ...
@@ -159,7 +159,7 @@ ORIG_BUILDFLAGS+=( $REBUILD_FLAG )
159 159
 BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
160 160
 
161 161
 # Test timeout.
162
-if [ "${DOCKER_ENGINE_GOARCH}" == "arm" ]; then
162
+if [ "${DOCKER_ENGINE_GOARCH}" == "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" == "arm" ]; then
163 163
 	: ${TIMEOUT:=10m}
164 164
 elif [ "${DOCKER_ENGINE_GOARCH}" == "windows" ]; then
165 165
 	: ${TIMEOUT:=8m}
... ...
@@ -25,7 +25,10 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) {
25 25
 	c.Assert(err, checker.IsNil)
26 26
 
27 27
 	b := bytes.NewBuffer(nil)
28
-	go io.Copy(b, p)
28
+	go func() {
29
+		io.Copy(b, p)
30
+		p.Close()
31
+	}()
29 32
 
30 33
 	ch := make(chan error)
31 34
 	go func() { ch <- cmd.Wait() }()
... ...
@@ -33,9 +36,7 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) {
33 33
 	select {
34 34
 	case err := <-ch:
35 35
 		c.Assert(err, checker.IsNil)
36
-		bs := b.Bytes()
37
-		bs = bytes.Trim(bs, "\x00")
38
-		output := string(bs[:])
36
+		output := b.String()
39 37
 		c.Assert(strings.TrimSpace(output), checker.Equals, "hello")
40 38
 	case <-time.After(5 * time.Second):
41 39
 		c.Fatal("timed out running docker exec")
... ...
@@ -22,7 +22,7 @@ func ServicePoll(config *poll.Settings) {
22 22
 	config.Timeout = 30 * time.Second
23 23
 	config.Delay = 100 * time.Millisecond
24 24
 	if runtime.GOARCH == "arm64" || runtime.GOARCH == "arm" {
25
-		config.Timeout = 1 * time.Minute
25
+		config.Timeout = 90 * time.Second
26 26
 	}
27 27
 }
28 28