Add integration test

to make sure apiserver is up and running and that the pod can be
accessed via kubectl.
pull/5757/head
Priya Wadhwa 2019-10-28 16:50:01 -07:00
parent 993967bcc7
commit c3dd5bc0c6
1 changed files with 12 additions and 0 deletions

View File

@ -60,6 +60,7 @@ func TestFunctional(t *testing.T) {
}{
{"StartWithProxy", validateStartWithProxy}, // Set everything else up for success
{"KubeContext", validateKubeContext}, // Racy: must come immediately after "minikube start"
{"KubeContext", validateKubectlGetPods}, // Make sure apiserver is up
{"CacheCmd", validateCacheCmd}, // Caches images needed for subsequent tests because of proxy
}
for _, tc := range tests {
@ -142,6 +143,17 @@ func validateKubeContext(ctx context.Context, t *testing.T, profile string) {
}
}
// validateKubectlGetPods asserts that `kubectl get pod -A` returns non-zero content
func validateKubectlGetPods(ctx context.Context, t *testing.T, profile string) {
rr, err := Run(t, exec.CommandContext(ctx, "kubectl", "get", "pod", "-A"))
if err != nil {
t.Errorf("%s failed: %v", rr.Args, err)
}
if !strings.Contains(rr.Stdout.String(), "kube-apiserver-minikube") {
t.Errorf("kube-apiserver-minikube is not up in running, got: %s\n", rr.Stdout.String())
}
}
// validateAddonManager asserts that the kube-addon-manager pod is deployed properly
func validateAddonManager(ctx context.Context, t *testing.T, profile string) {
// If --wait=false, this may take a couple of minutes