From 30bd74cff2c9d0eff3336b37c8393b3824c5d877 Mon Sep 17 00:00:00 2001 From: Pablo Caderno Date: Mon, 17 Aug 2020 12:52:21 +1000 Subject: [PATCH] Added integration test Signed-off-by: Pablo Caderno --- test/integration/functional_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index 06874156f5cc..c7054b7a7236 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -24,6 +24,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + // "io" "net/http" "net/url" "os" @@ -86,6 +87,7 @@ func TestFunctional(t *testing.T) { {"KubectlGetPods", validateKubectlGetPods}, // Make sure apiserver is up {"CacheCmd", validateCacheCmd}, // Caches images needed for subsequent tests because of proxy {"MinikubeKubectlCmd", validateMinikubeKubectl}, // Make sure `minikube kubectl` works + {"MinikubeKubectlCmdDirectly",validateMinikubeKubectlDirectCall}, } for _, tc := range tests { tc := tc @@ -307,6 +309,26 @@ func validateMinikubeKubectl(ctx context.Context, t *testing.T, profile string) } } +// validateMinikubeKubectlDirectCall validates that calling minikube's kubectl +func validateMinikubeKubectlDirectCall(ctx context.Context, t *testing.T, profile string) { + defer PostMortemLogs(t, profile) + dir := filepath.Dir(Target()) + dstfn := filepath.Join(dir, "kubectl") + err := os.Link(Target(), dstfn) + + if err != nil { + t.Fatal(err) + } + defer os.Remove(dstfn) // clean up + + kubectlArgs := []string{"-p", profile, "--", "--context", profile, "get", "pods"} + rr, err := Run(t, exec.CommandContext(ctx, dstfn, kubectlArgs...)) + if err != nil { + t.Fatalf("failed to run kubectl directl. args %q: %v", rr.Command(), err) + } + +} + // validateComponentHealth asserts that all Kubernetes components are healthy func validateComponentHealth(ctx context.Context, t *testing.T, profile string) { defer PostMortemLogs(t, profile)