update test

Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
aiordache 2021-03-05 16:30:52 +01:00
parent 34df3caaaf
commit fef479ad1f
2 changed files with 5 additions and 6 deletions

View File

@ -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"

View File

@ -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) {