mirror of
https://github.com/moby/moby.git
synced 2025-12-17 00:02:44 +03:00
integration-cli: DockerCLIExecSuite: replace dockerCmd and waitRun
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -11,13 +11,14 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/creack/pty"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
// regression test for #12546
|
||||
func (s *DockerCLIExecSuite) TestExecInteractiveStdinClose(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
|
||||
out := cli.DockerCmd(c, "run", "-itd", "busybox", "/bin/cat").Stdout()
|
||||
contID := strings.TrimSpace(out)
|
||||
|
||||
cmd := exec.Command(dockerBinary, "exec", "-i", contID, "echo", "-n", "hello")
|
||||
@@ -46,7 +47,7 @@ func (s *DockerCLIExecSuite) TestExecInteractiveStdinClose(c *testing.T) {
|
||||
|
||||
func (s *DockerCLIExecSuite) TestExecTTY(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
dockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top")
|
||||
cli.DockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top")
|
||||
|
||||
cmd := exec.Command(dockerBinary, "exec", "-it", "test", "sh")
|
||||
p, err := pty.Start(cmd)
|
||||
@@ -76,7 +77,7 @@ func (s *DockerCLIExecSuite) TestExecTTY(c *testing.T) {
|
||||
// Test the TERM env var is set when -t is provided on exec
|
||||
func (s *DockerCLIExecSuite) TestExecWithTERM(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
out, _ := dockerCmd(c, "run", "-id", "busybox", "/bin/cat")
|
||||
out := cli.DockerCmd(c, "run", "-id", "busybox", "/bin/cat").Stdout()
|
||||
contID := strings.TrimSpace(out)
|
||||
cmd := exec.Command(dockerBinary, "exec", "-t", contID, "sh", "-c", "if [ -z $TERM ]; then exit 1; else exit 0; fi")
|
||||
if err := cmd.Run(); err != nil {
|
||||
@@ -88,7 +89,7 @@ func (s *DockerCLIExecSuite) TestExecWithTERM(c *testing.T) {
|
||||
// on run
|
||||
func (s *DockerCLIExecSuite) TestExecWithNoTERM(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
|
||||
out := cli.DockerCmd(c, "run", "-itd", "busybox", "/bin/cat").Stdout()
|
||||
contID := strings.TrimSpace(out)
|
||||
cmd := exec.Command(dockerBinary, "exec", contID, "sh", "-c", "if [ -z $TERM ]; then exit 0; else exit 1; fi")
|
||||
if err := cmd.Run(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user