diff --git a/test/integration/addons_test.go b/test/integration/addons_test.go index 25c16df2c2..1705c17b0e 100644 --- a/test/integration/addons_test.go +++ b/test/integration/addons_test.go @@ -38,13 +38,8 @@ var ( dashboardSvcCmd = []string{"get", "svc", "kubernetes-dashboard", "--namespace=kube-system"} ) -func TestAddons(t *testing.T) { - minikubeRunner := util.MinikubeRunner{ - BinaryPath: *binaryPath, - Args: *args, - T: t} - - minikubeRunner.EnsureRunning() +func testAddons(t *testing.T) { + t.Parallel() kubectlRunner := util.NewKubectlRunner(t) checkAddon := func() error { @@ -70,23 +65,23 @@ func TestAddons(t *testing.T) { } } -func TestDashboard(t *testing.T) { +func testDashboard(t *testing.T) { + t.Parallel() + kubectlRunner := util.NewKubectlRunner(t) minikubeRunner := util.MinikubeRunner{ BinaryPath: *binaryPath, Args: *args, T: t} - minikubeRunner.EnsureRunning() - kubectlRunner := util.NewKubectlRunner(t) checkDashboard := func() error { rc := api.ReplicationController{} svc := api.Service{} if err := kubectlRunner.RunCommandParseOutput(dashboardRcCmd, &rc); err != nil { - return err + return &commonutil.RetriableError{Err: err} } if err := kubectlRunner.RunCommandParseOutput(dashboardSvcCmd, &svc); err != nil { - return err + return &commonutil.RetriableError{Err: err} } if rc.Status.Replicas != rc.Status.FullyLabeledReplicas { @@ -100,7 +95,7 @@ func TestDashboard(t *testing.T) { return nil } - if err := commonutil.RetryAfter(10, checkDashboard, 5*time.Second); err != nil { + if err := commonutil.RetryAfter(60, checkDashboard, 5*time.Second); err != nil { t.Fatalf("Dashboard is unhealthy: %s", err) } @@ -121,17 +116,23 @@ func TestDashboard(t *testing.T) { } } -func TestServicesList(t *testing.T) { +func testServicesList(t *testing.T) { + t.Parallel() minikubeRunner := util.MinikubeRunner{ BinaryPath: *binaryPath, Args: *args, T: t} - minikubeRunner.EnsureRunning() - output := minikubeRunner.RunCommand("service list", true) - for _, svc := range []string{"kubernetes", "kube-dns", "kubernetes-dashboard"} { - if !strings.Contains(output, svc) { - t.Errorf("Error, service %s missing from output %s", svc, output) + checkServices := func() error { + output := minikubeRunner.RunCommand("service list", false) + if !strings.Contains(output, "kubernetes") { + return &commonutil.RetriableError{ + Err: fmt.Errorf("Error, kubernetes service missing from output %s", output), + } } + return nil + } + if err := commonutil.RetryAfter(5, checkServices, 2*time.Second); err != nil { + t.Fatalf(err.Error()) } } diff --git a/test/integration/cluster_dns_test.go b/test/integration/cluster_dns_test.go index afd821c94f..820a00fc8a 100644 --- a/test/integration/cluster_dns_test.go +++ b/test/integration/cluster_dns_test.go @@ -30,13 +30,8 @@ import ( "k8s.io/minikube/test/integration/util" ) -func TestClusterDNS(t *testing.T) { - minikubeRunner := util.MinikubeRunner{ - BinaryPath: *binaryPath, - Args: *args, - T: t} - minikubeRunner.EnsureRunning() - +func testClusterDNS(t *testing.T) { + t.Parallel() kubectlRunner := util.NewKubectlRunner(t) podName := "busybox" podPath, _ := filepath.Abs("testdata/busybox.yaml") @@ -68,7 +63,7 @@ func TestClusterDNS(t *testing.T) { return nil } - if err := commonutil.RetryAfter(4, dnsTest, 1*time.Second); err != nil { + if err := commonutil.RetryAfter(40, dnsTest, 5*time.Second); err != nil { t.Fatalf("DNS lookup failed with error:", err) } } diff --git a/test/integration/cluster_env_test.go b/test/integration/cluster_env_test.go index 92cf1293fa..c78ed4b58a 100644 --- a/test/integration/cluster_env_test.go +++ b/test/integration/cluster_env_test.go @@ -27,12 +27,12 @@ import ( "k8s.io/minikube/test/integration/util" ) -func TestClusterEnv(t *testing.T) { +func testClusterEnv(t *testing.T) { + t.Parallel() minikubeRunner := util.MinikubeRunner{ Args: *args, BinaryPath: *binaryPath, T: t} - minikubeRunner.EnsureRunning() dockerEnvVars := minikubeRunner.RunCommand("docker-env", true) if err := minikubeRunner.SetEnvFromEnvCmdOutput(dockerEnvVars); err != nil { diff --git a/test/integration/cluster_logs_test.go b/test/integration/cluster_logs_test.go index 37d0960356..620d013387 100644 --- a/test/integration/cluster_logs_test.go +++ b/test/integration/cluster_logs_test.go @@ -19,13 +19,15 @@ limitations under the License. package integration import ( - "k8s.io/minikube/pkg/minikube/constants" - "k8s.io/minikube/test/integration/util" "strings" "testing" + + "k8s.io/minikube/pkg/minikube/constants" + "k8s.io/minikube/test/integration/util" ) -func TestClusterLogs(t *testing.T) { +func testClusterLogs(t *testing.T) { + t.Parallel() minikubeRunner := util.MinikubeRunner{ Args: *args, BinaryPath: *binaryPath, diff --git a/test/integration/cluster_ssh_test.go b/test/integration/cluster_ssh_test.go index 9c2b10581e..bc6835c28c 100644 --- a/test/integration/cluster_ssh_test.go +++ b/test/integration/cluster_ssh_test.go @@ -19,17 +19,18 @@ limitations under the License. package integration import ( - "k8s.io/minikube/test/integration/util" "strings" "testing" + + "k8s.io/minikube/test/integration/util" ) -func TestClusterSSH(t *testing.T) { +func testClusterSSH(t *testing.T) { + t.Parallel() minikubeRunner := util.MinikubeRunner{ Args: *args, BinaryPath: *binaryPath, T: t} - minikubeRunner.EnsureRunning() expectedStr := "hello" sshCmdOutput := minikubeRunner.RunCommand("ssh echo "+expectedStr, true) diff --git a/test/integration/cluster_status_test.go b/test/integration/cluster_status_test.go index b314ec445d..a7f3d41a9d 100644 --- a/test/integration/cluster_status_test.go +++ b/test/integration/cluster_status_test.go @@ -28,13 +28,8 @@ import ( "k8s.io/minikube/test/integration/util" ) -func TestClusterStatus(t *testing.T) { - minikubeRunner := util.MinikubeRunner{ - Args: *args, - BinaryPath: *binaryPath, - T: t} - minikubeRunner.EnsureRunning() - +func testClusterStatus(t *testing.T) { + t.Parallel() kubectlRunner := util.NewKubectlRunner(t) cs := api.ComponentStatusList{} diff --git a/test/integration/docker_env_test.go b/test/integration/docker_env_test.go index 8cf5e18732..76b4c34173 100644 --- a/test/integration/docker_env_test.go +++ b/test/integration/docker_env_test.go @@ -32,7 +32,7 @@ func TestDockerEnv(t *testing.T) { BinaryPath: *binaryPath, T: t} - minikubeRunner.RunCommand("delete", true) + minikubeRunner.RunCommand("delete", false) startCmd := fmt.Sprintf("start %s %s", minikubeRunner.Args, "--docker-env=FOO=BAR --docker-env=BAZ=BAT") minikubeRunner.RunCommand(startCmd, true) diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go new file mode 100644 index 0000000000..4aa7c56422 --- /dev/null +++ b/test/integration/functional_test.go @@ -0,0 +1,42 @@ +// +build integration + +/* +Copyright 2016 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package integration + +import ( + "testing" + + "k8s.io/minikube/test/integration/util" +) + +func TestFunctional(t *testing.T) { + minikubeRunner := util.MinikubeRunner{ + BinaryPath: *binaryPath, + Args: *args, + T: t} + minikubeRunner.EnsureRunning() + + t.Run("DNS", testClusterDNS) + t.Run("EnvVars", testClusterEnv) + t.Run("Logs", testClusterLogs) + t.Run("SSH", testClusterSSH) + t.Run("Status", testClusterStatus) + t.Run("Addons", testAddons) + t.Run("Dashboard", testDashboard) + t.Run("ServicesList", testServicesList) +}