Jelajahi Sumber

update test

Signed-off-by: aiordache <[email protected]>
aiordache 4 tahun lalu
induk
melakukan
fef479ad1f
2 mengubah file dengan 5 tambahan dan 6 penghapusan
  1. 1 1
      cli/main.go
  2. 4 5
      local/e2e/cli-only/e2e_test.go

+ 1 - 1
cli/main.go

@@ -212,7 +212,7 @@ func main() {
 		compose.Command(ctype),
 		volume.Command(ctype),
 	)
-	if ctype == store.LocalContextType {
+	if ctype == store.DefaultContextType || ctype == store.LocalContextType {
 		if len(opts.Hosts) > 0 {
 			opts.Context = ""
 			currentContext = "default"

+ 4 - 5
local/e2e/cli-only/e2e_test.go

@@ -396,15 +396,14 @@ func TestLegacy(t *testing.T) {
 	})
 
 	t.Run("host flag", func(t *testing.T) {
-		stderr := "dial tcp: lookup nonexistent"
-		if runtime.GOOS == "windows" {
-			stderr = "dial tcp: lookup nonexistent: no such host"
-		}
+		stderr := []string{"dial tcp: lookup nonexistent", "no such host"}
 		res := c.RunDockerOrExitError("-H", "tcp://nonexistent:123", "version")
 		res.Assert(t, icmd.Expected{
 			ExitCode: 1,
 		})
-		assert.Assert(t, strings.Contains(res.Stderr(), stderr), res.Stderr())
+		for _, s := range stderr {
+			assert.Assert(t, strings.Contains(res.Stderr(), s), res.Stderr())
+		}
 	})
 
 	t.Run("existing contexts delegate", func(t *testing.T) {