From c3dd5bc0c60a4681baab4fa8408565f73e756b2e Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 28 Oct 2019 16:50:01 -0700 Subject: [PATCH] Add integration test to make sure apiserver is up and running and that the pod can be accessed via kubectl. --- test/integration/functional_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index b3af56ec5c..a3a76efbc8 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -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