mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
Merge pull request #362 from docker/fix_aci_tests
Fix ACI e2e tests : do not use console if no tty option set in exec
This commit is contained in:
commit
1e3b90f4f8
@ -19,6 +19,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containerd/console"
|
"github.com/containerd/console"
|
||||||
@ -56,9 +57,8 @@ func runExec(ctx context.Context, opts execOpts, name string, command string) er
|
|||||||
return errors.Wrap(err, "cannot connect to backend")
|
return errors.Wrap(err, "cannot connect to backend")
|
||||||
}
|
}
|
||||||
|
|
||||||
con := console.Current()
|
|
||||||
|
|
||||||
if opts.Tty {
|
if opts.Tty {
|
||||||
|
con := console.Current()
|
||||||
if err := con.SetRaw(); err != nil {
|
if err := con.SetRaw(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ func runExec(ctx context.Context, opts execOpts, name string, command string) er
|
|||||||
fmt.Println("Unable to close the console")
|
fmt.Println("Unable to close the console")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
return c.ContainerService().Exec(ctx, name, command, con, con)
|
||||||
}
|
}
|
||||||
|
return c.ContainerService().Exec(ctx, name, command, os.Stdin, os.Stdout)
|
||||||
return c.ContainerService().Exec(ctx, name, command, con, con)
|
|
||||||
}
|
}
|
||||||
|
@ -151,11 +151,8 @@ func (s *E2eACISuite) TestACIBackend() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
s.T().Run("exec command", func(t *testing.T) {
|
s.T().Run("exec command", func(t *testing.T) {
|
||||||
output := s.NewDockerCommand("exec", testContainerName, "pwd").ExecOrDie()
|
_, err := s.NewDockerCommand("exec", testContainerName, "echo", "fail_with_argument").Exec()
|
||||||
Expect(output).To(ContainSubstring("/"))
|
Expect(err.Error()).To(ContainSubstring("ACI exec command does not accept arguments to the command. " +
|
||||||
|
|
||||||
output = s.NewDockerCommand("exec", testContainerName, "echo", "fail_with_argument").ExecOrDie()
|
|
||||||
Expect(output).To(ContainSubstring("ACI exec command does not accept arguments to the command. " +
|
|
||||||
"Only the binary should be specified"))
|
"Only the binary should be specified"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user