From 5fb29ebae7c91237b67a650ff2235a49d48ff8bb Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Tue, 30 Jul 2019 16:36:53 -0700 Subject: [PATCH] refactor] --- test/integration/flags.go | 2 +- .../{fn_test.go => functional_test.go} | 0 test/integration/start_stop_delete_test.go | 80 +++++++++---------- .../{proxy_test.go => z_proxy_test.go} | 1 + 4 files changed, 41 insertions(+), 42 deletions(-) rename test/integration/{fn_test.go => functional_test.go} (100%) rename test/integration/{proxy_test.go => z_proxy_test.go} (97%) diff --git a/test/integration/flags.go b/test/integration/flags.go index 9d2532ad50..c762415ab9 100644 --- a/test/integration/flags.go +++ b/test/integration/flags.go @@ -32,7 +32,7 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } -var startTimeout = flag.Int("timeout", 18, "number of minutes to wait for minikube start") +var startTimeout = flag.Int("timeout", 25, "number of minutes to wait for minikube start") var binaryPath = flag.String("binary", "../../out/minikube", "path to minikube binary") var globalArgs = flag.String("minikube-args", "", "Arguments to pass to minikube") var startArgs = flag.String("minikube-start-args", "", "Arguments to pass to minikube start") diff --git a/test/integration/fn_test.go b/test/integration/functional_test.go similarity index 100% rename from test/integration/fn_test.go rename to test/integration/functional_test.go diff --git a/test/integration/start_stop_delete_test.go b/test/integration/start_stop_delete_test.go index 78ee000c60..5dcfc327e1 100644 --- a/test/integration/start_stop_delete_test.go +++ b/test/integration/start_stop_delete_test.go @@ -37,52 +37,50 @@ func TestStartStop(t *testing.T) { } else { t.Parallel() } - mk := NewMinikubeRunner(t, p) - if !isTestNoneDriver() { // none driver doesn't need to be deleted - defer mk.TearDown(t) - } - - tests := []struct { - name string - args []string - }{ - {"oldest", []string{ // nocache_oldest - "--cache-images=false", - fmt.Sprintf("--kubernetes-version=%s", constants.OldestKubernetesVersion), - // default is the network created by libvirt, if we change the name minikube won't boot - // because the given network doesn't exist - "--kvm-network=default", - "--kvm-qemu-uri=qemu:///system", - }}, - {"cni", []string{ // feature_gates_newest_cni - "--feature-gates", - "ServerSideApply=true", - "--network-plugin=cni", - "--extra-config=kubelet.network-plugin=cni", - "--extra-config=kubeadm.pod-network-cidr=192.168.111.111/16", - fmt.Sprintf("--kubernetes-version=%s", constants.NewestKubernetesVersion), - }}, - {"containerd", []string{ // containerd_and_non_default_apiserver_port - "--container-runtime=containerd", - "--docker-opt containerd=/var/run/containerd/containerd.sock", - "--apiserver-port=8444", - }}, - {"crio", []string{ // crio_ignore_preflights - "--container-runtime=crio", - "--extra-config", - "kubeadm.ignore-preflight-errors=SystemVerification", - }}, - } t.Run("group", func(t *testing.T) { - t.Parallel() + if !isTestNoneDriver() { + t.Parallel() + } + tests := []struct { + name string + args []string + }{ + {"oldest", []string{ // nocache_oldest + "--cache-images=false", + fmt.Sprintf("--kubernetes-version=%s", constants.OldestKubernetesVersion), + // default is the network created by libvirt, if we change the name minikube won't boot + // because the given network doesn't exist + "--kvm-network=default", + "--kvm-qemu-uri=qemu:///system", + }}, + {"cni", []string{ // feature_gates_newest_cni + "--feature-gates", + "ServerSideApply=true", + "--network-plugin=cni", + "--extra-config=kubelet.network-plugin=cni", + "--extra-config=kubeadm.pod-network-cidr=192.168.111.111/16", + fmt.Sprintf("--kubernetes-version=%s", constants.NewestKubernetesVersion), + }}, + {"containerd", []string{ // containerd_and_non_default_apiserver_port + "--container-runtime=containerd", + "--docker-opt containerd=/var/run/containerd/containerd.sock", + "--apiserver-port=8444", + }}, + {"crio", []string{ // crio_ignore_preflights + "--container-runtime=crio", + "--extra-config", + "kubeadm.ignore-preflight-errors=SystemVerification", + }}, + } + for _, tc := range tests { n := tc.name // because similar to https://golang.org/doc/faq#closures_and_goroutines t.Run(tc.name, func(t *testing.T) { t.Parallel() - p = p + n - mk := NewMinikubeRunner(t, p) + pn := p + n + mk := NewMinikubeRunner(t, pn) // TODO : redundant first clause, this test never happens for none - if !strings.Contains(p, "docker") && isTestNoneDriver() { + if !strings.Contains(pn, "docker") && isTestNoneDriver() { t.Skipf("skipping %s - incompatible with none driver", t.Name()) } @@ -92,7 +90,7 @@ func TestStartStop(t *testing.T) { stdout, stderr, err := mk.Start(tc.args...) if err != nil { - t.Fatalf("%s minikube start failed : %v\nstdout: %s\nstderr: %s", p, err, stdout, stderr) + t.Fatalf("%s minikube start failed : %v\nstdout: %s\nstderr: %s", pn, err, stdout, stderr) } mk.CheckStatus(state.Running.String()) diff --git a/test/integration/proxy_test.go b/test/integration/z_proxy_test.go similarity index 97% rename from test/integration/proxy_test.go rename to test/integration/z_proxy_test.go index ac17174274..619055f046 100644 --- a/test/integration/proxy_test.go +++ b/test/integration/z_proxy_test.go @@ -16,6 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +// the name of this file starts with z intentionally to make it run last after all other tests package integration import (