Skip to content

Commit

Permalink
Added integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Caderno <[email protected]>
  • Loading branch information
kadern0 committed Aug 17, 2020
1 parent b46e753 commit 30bd74c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/integration/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
// "io"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 30bd74c

Please sign in to comment.