Only run TestOffline for specified container runtime

pull/10196/head
Priya Wadhwa 2021-01-20 16:50:03 -08:00
parent 2f81d4874f
commit e2359569e4
2 changed files with 17 additions and 1 deletions

View File

@ -33,7 +33,9 @@ func TestOffline(t *testing.T) {
rt := rt
t.Run(rt, func(t *testing.T) {
MaybeParallel(t)
if requestedRuntime := ContainerRuntime(); requestedRuntime != "" && requestedRuntime != rt {
t.Skipf("skipping test for container runtime %s, only testing runtime %s", rt, requestedRuntime)
}
if rt != "docker" && arm64Platform() {
t.Skipf("skipping %s - only docker runtime supported on arm64. See https://github.com/kubernetes/minikube/issues/10144", t.Name())
}

View File

@ -124,6 +124,20 @@ func PodmanDriver() bool {
return strings.Contains(*startArgs, "--vm-driver=podman") || strings.Contains(*startArgs, "driver=podman")
}
// ContainerRuntime returns the name of a specific container runtime if it was specified
func ContainerRuntime() string {
flag := "--container-runtime="
if !strings.Contains(*startArgs, flag) {
return ""
}
for _, s := range StartArgs() {
if strings.HasPrefix(s, flag) {
return strings.TrimPrefix(s, flag)
}
}
return ""
}
// KicDriver returns whether or not this test is using the docker or podman driver
func KicDriver() bool {
return DockerDriver() || PodmanDriver()