Merge pull request #6588 from priyawadhwa/minikube-kubectl-test
Add integration test for minikube kubectl commandpull/6651/head
commit
dba9ce14ad
|
|
@ -70,11 +70,12 @@ func TestFunctional(t *testing.T) {
|
||||||
name string
|
name string
|
||||||
validator validateFunc
|
validator validateFunc
|
||||||
}{
|
}{
|
||||||
{"CopySyncFile", setupFileSync}, // Set file for the file sync test case
|
{"CopySyncFile", setupFileSync}, // Set file for the file sync test case
|
||||||
{"StartWithProxy", validateStartWithProxy}, // Set everything else up for success
|
{"StartWithProxy", validateStartWithProxy}, // Set everything else up for success
|
||||||
{"KubeContext", validateKubeContext}, // Racy: must come immediately after "minikube start"
|
{"KubeContext", validateKubeContext}, // Racy: must come immediately after "minikube start"
|
||||||
{"KubectlGetPods", validateKubectlGetPods}, // Make sure apiserver is up
|
{"KubectlGetPods", validateKubectlGetPods}, // Make sure apiserver is up
|
||||||
{"CacheCmd", validateCacheCmd}, // Caches images needed for subsequent tests because of proxy
|
{"CacheCmd", validateCacheCmd}, // Caches images needed for subsequent tests because of proxy
|
||||||
|
{"MinikubeKubectlCmd", validateMinikubeKubectl}, // Make sure `minikube kubectl` works
|
||||||
}
|
}
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
tc := tc
|
tc := tc
|
||||||
|
|
@ -206,6 +207,15 @@ func validateKubectlGetPods(ctx context.Context, t *testing.T, profile string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validateMinikubeKubectl validates that the `minikube kubectl` command returns content
|
||||||
|
func validateMinikubeKubectl(ctx context.Context, t *testing.T, profile string) {
|
||||||
|
kubectlArgs := []string{"kubectl", "--", "get", "pods"}
|
||||||
|
rr, err := Run(t, exec.CommandContext(ctx, Target(), kubectlArgs...))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("%s failed: %v", rr.Args, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// validateComponentHealth asserts that all Kubernetes components are healthy
|
// validateComponentHealth asserts that all Kubernetes components are healthy
|
||||||
func validateComponentHealth(ctx context.Context, t *testing.T, profile string) {
|
func validateComponentHealth(ctx context.Context, t *testing.T, profile string) {
|
||||||
rr, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "cs", "-o=json"))
|
rr, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "cs", "-o=json"))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue