I'm about to refactor the code which includes the Kubernetes support in a way
which relies on something vendoring `./cli/context/kubernetes/` in order to
trigger the inclusion of support for the Kubernetes endpoint in the final
binary.
In practice anything which is interested in Kubernetes must import that package
(e.g. `./cli/command/context.list` does for the `EndpointFromContext`
function). However if it was somehow possible to build without that import then
the `KUBERNETES ENDPOINT` column would be mysteriously empty.
Out of an abundance of caution add a specific check on the final binary.
Signed-off-by: Ian Campbell <ijc@docker.com>
(cherry picked from commit d5d693aa6e)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
22 lines
444 B
Go
22 lines
444 B
Go
package context
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/golden"
|
|
"gotest.tools/icmd"
|
|
)
|
|
|
|
func TestContextList(t *testing.T) {
|
|
cmd := icmd.Command("docker", "context", "ls")
|
|
cmd.Env = append(cmd.Env,
|
|
"DOCKER_CONFIG=./testdata/test-dockerconfig",
|
|
"KUBECONFIG=./testdata/test-kubeconfig",
|
|
)
|
|
result := icmd.RunCmd(cmd).Assert(t, icmd.Expected{
|
|
Err: icmd.None,
|
|
ExitCode: 0,
|
|
})
|
|
golden.Assert(t, result.Stdout(), "context-ls.golden")
|
|
}
|