Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 1e3b90f

Browse files
authored
Merge pull request #362 from docker/fix_aci_tests
Fix ACI e2e tests : do not use console if no tty option set in exec
2 parents 16acc36 + c5cd0f4 commit 1e3b90f

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

cli/cmd/exec.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package cmd
1919
import (
2020
"context"
2121
"fmt"
22+
"os"
2223
"strings"
2324

2425
"github.com/containerd/console"
@@ -56,9 +57,8 @@ func runExec(ctx context.Context, opts execOpts, name string, command string) er
5657
return errors.Wrap(err, "cannot connect to backend")
5758
}
5859

59-
con := console.Current()
60-
6160
if opts.Tty {
61+
con := console.Current()
6262
if err := con.SetRaw(); err != nil {
6363
return err
6464
}
@@ -67,7 +67,7 @@ func runExec(ctx context.Context, opts execOpts, name string, command string) er
6767
fmt.Println("Unable to close the console")
6868
}
6969
}()
70+
return c.ContainerService().Exec(ctx, name, command, con, con)
7071
}
71-
72-
return c.ContainerService().Exec(ctx, name, command, con, con)
72+
return c.ContainerService().Exec(ctx, name, command, os.Stdin, os.Stdout)
7373
}

tests/aci-e2e/e2e-aci_test.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,8 @@ func (s *E2eACISuite) TestACIBackend() {
151151
})
152152

153153
s.T().Run("exec command", func(t *testing.T) {
154-
output := s.NewDockerCommand("exec", testContainerName, "pwd").ExecOrDie()
155-
Expect(output).To(ContainSubstring("/"))
156-
157-
output = s.NewDockerCommand("exec", testContainerName, "echo", "fail_with_argument").ExecOrDie()
158-
Expect(output).To(ContainSubstring("ACI exec command does not accept arguments to the command. " +
154+
_, err := s.NewDockerCommand("exec", testContainerName, "echo", "fail_with_argument").Exec()
155+
Expect(err.Error()).To(ContainSubstring("ACI exec command does not accept arguments to the command. " +
159156
"Only the binary should be specified"))
160157
})
161158

0 commit comments

Comments
 (0)