Merge pull request #1410 from gtardif/context_endpoint_connection

Add remote engine context e2e
This commit is contained in:
Nicolas De loof 2021-03-10 14:18:28 +01:00 committed by GitHub
commit f0fbc43ef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

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