|
|
@@ -19,6 +19,7 @@ package main
|
|
|
import (
|
|
|
"os"
|
|
|
"path/filepath"
|
|
|
+ "runtime"
|
|
|
"testing"
|
|
|
"time"
|
|
|
|
|
|
@@ -187,18 +188,19 @@ func (s *E2eSuite) TestLeaveLegacyErrorMessagesUnchanged() {
|
|
|
|
|
|
func (s *E2eSuite) TestPassThroughRootLegacyFlags() {
|
|
|
output, err := s.NewDockerCommand("-H", "tcp://localhost:123", "version").Exec()
|
|
|
- Expect(err).To(BeNil())
|
|
|
- Expect(output).To(ContainSubstring("Client:"))
|
|
|
+ Expect(err).NotTo(BeNil())
|
|
|
+ Expect(output).NotTo(ContainSubstring("unknown shorthand flag"))
|
|
|
Expect(output).To(ContainSubstring("localhost:123"))
|
|
|
|
|
|
output, _ = s.NewDockerCommand("-H", "tcp://localhost:123", "login", "-u", "nouser", "-p", "wrongpasword").Exec()
|
|
|
+ Expect(output).NotTo(ContainSubstring("unknown shorthand flag"))
|
|
|
Expect(output).To(ContainSubstring("WARNING! Using --password via the CLI is insecure"))
|
|
|
|
|
|
output, _ = s.NewDockerCommand("--log-level", "debug", "login", "-u", "nouser", "-p", "wrongpasword").Exec()
|
|
|
+ Expect(output).NotTo(ContainSubstring("unknown shorthand flag"))
|
|
|
Expect(output).To(ContainSubstring("WARNING! Using --password via the CLI is insecure"))
|
|
|
|
|
|
output, _ = s.NewDockerCommand("login", "--help").Exec()
|
|
|
- Expect(output).NotTo(ContainSubstring("--host"))
|
|
|
Expect(output).NotTo(ContainSubstring("--log-level"))
|
|
|
}
|
|
|
|
|
|
@@ -209,6 +211,21 @@ func (s *E2eSuite) TestDisplayFriendlyErrorMessageForLegacyCommands() {
|
|
|
Expect(err).NotTo(BeNil())
|
|
|
}
|
|
|
|
|
|
+func (s *E2eSuite) TestExecMobyIfUsingHostFlag() {
|
|
|
+ s.NewDockerCommand("context", "create", "example", "test-example").ExecOrDie()
|
|
|
+ s.NewDockerCommand("context", "use", "test-example").ExecOrDie()
|
|
|
+ output, err := s.NewDockerCommand("-H", defaultEndpoint(), "ps").Exec()
|
|
|
+ Expect(err).To(BeNil())
|
|
|
+ Expect(output).To(ContainSubstring("CONTAINER ID"))
|
|
|
+}
|
|
|
+
|
|
|
+func defaultEndpoint() string {
|
|
|
+ if runtime.GOOS == "windows" {
|
|
|
+ return "npipe:////./pipe/docker_engine"
|
|
|
+ }
|
|
|
+ return "unix:///var/run/docker.sock"
|
|
|
+}
|
|
|
+
|
|
|
func (s *E2eSuite) TestDisplaysAdditionalLineInDockerVersion() {
|
|
|
output := s.NewDockerCommand("version").ExecOrDie()
|
|
|
Expect(output).To(ContainSubstring("Azure integration"))
|