From f4c68428bd36524a3f100170a7871989a97aee30 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Wed, 10 Mar 2021 11:27:20 +0100 Subject: [PATCH] Add remote engine context e2e Signed-off-by: Guillaume Tardif --- local/e2e/cli-only/e2e_test.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/local/e2e/cli-only/e2e_test.go b/local/e2e/cli-only/e2e_test.go index 689cc56ba..21136ab1e 100644 --- a/local/e2e/cli-only/e2e_test.go +++ b/local/e2e/cli-only/e2e_test.go @@ -396,16 +396,21 @@ 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" - } res := c.RunDockerOrExitError("-H", "tcp://nonexistent:123", "version") assert.Assert(t, res.ExitCode == 1) - assert.Assert(t, strings.Contains(res.Stdout(), stderr), res.Stdout()) + assert.Assert(t, strings.Contains(res.Stdout(), "dial tcp: lookup nonexistent"), res.Stdout()) }) + t.Run("remote engine context", func(t *testing.T) { + c.RunDockerCmd("context", "create", "test-remote-engine", "--docker", "host=tcp://nonexistent:1234") + c.RunDockerCmd("context", "use", "test-remote-engine") + + res := c.RunDockerOrExitError("version") + assert.Assert(t, res.ExitCode == 1) + assert.Assert(t, strings.Contains(res.Stdout(), "dial tcp: lookup nonexistent"), res.Stdout()) + }) + t.Run("existing contexts delegate", func(t *testing.T) { c.RunDockerCmd("context", "create", "moby-ctx", "--from=default") c.RunDockerCmd("context", "use", "moby-ctx")