refactor]

pull/4946/head
Medya Gh 2019-07-30 16:36:53 -07:00
parent aee599f011
commit 5fb29ebae7
4 changed files with 41 additions and 42 deletions

View File

@ -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")

View File

@ -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())

View File

@ -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 (