Merge pull request #10196 from priyawadhwa/refactor-test-offline
Only run TestOffline/TestDownloadOnly for specified container runtimepull/10219/head
commit
04ed63c1eb
|
@ -40,14 +40,13 @@ import (
|
|||
)
|
||||
|
||||
func TestDownloadOnly(t *testing.T) {
|
||||
for _, r := range []string{"crio", "docker", "containerd"} {
|
||||
t.Run(r, func(t *testing.T) {
|
||||
// Stores the startup run result for later error messages
|
||||
var rrr *RunResult
|
||||
|
||||
profile := UniqueProfileName(r)
|
||||
profile := UniqueProfileName("download-only")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), Minutes(30))
|
||||
defer Cleanup(t, profile, cancel)
|
||||
containerRuntime := ContainerRuntime()
|
||||
|
||||
versions := []string{
|
||||
constants.OldestKubernetesVersion,
|
||||
|
@ -60,7 +59,7 @@ func TestDownloadOnly(t *testing.T) {
|
|||
defer PostMortemLogs(t, profile)
|
||||
|
||||
// --force to avoid uid check
|
||||
args := append([]string{"start", "-o=json", "--download-only", "-p", profile, "--force", "--alsologtostderr", fmt.Sprintf("--kubernetes-version=%s", v), fmt.Sprintf("--container-runtime=%s", r)}, StartArgs()...)
|
||||
args := append([]string{"start", "-o=json", "--download-only", "-p", profile, "--force", "--alsologtostderr", fmt.Sprintf("--kubernetes-version=%s", v)}, StartArgs()...)
|
||||
|
||||
rt, err := Run(t, exec.CommandContext(ctx, Target(), args...))
|
||||
if rrr == nil {
|
||||
|
@ -89,9 +88,9 @@ func TestDownloadOnly(t *testing.T) {
|
|||
|
||||
// skip for none, as none driver does not have preload feature.
|
||||
if !NoneDriver() {
|
||||
if download.PreloadExists(v, r, true) {
|
||||
if download.PreloadExists(v, containerRuntime, true) {
|
||||
// Just make sure the tarball path exists
|
||||
if _, err := os.Stat(download.TarballPath(v, r)); err != nil {
|
||||
if _, err := os.Stat(download.TarballPath(v, containerRuntime)); err != nil {
|
||||
t.Errorf("failed to verify preloaded tarball file exists: %v", err)
|
||||
}
|
||||
return
|
||||
|
@ -163,8 +162,7 @@ func TestDownloadOnly(t *testing.T) {
|
|||
t.Errorf("failed to delete. args: %q: %v", rr.Command(), err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestDownloadOnlyKic(t *testing.T) {
|
||||
|
|
|
@ -26,14 +26,10 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
// TestOffline makes sure minikube works without internet, once it the user has already cached the images, This test has to run after TestDownloadOnly!
|
||||
// TestOffline makes sure minikube works without internet, once it the user has already cached the images, This test has to run after TestDownloadOnly
|
||||
func TestOffline(t *testing.T) {
|
||||
t.Run("group", func(t *testing.T) {
|
||||
for _, rt := range []string{"docker", "crio", "containerd"} {
|
||||
rt := rt
|
||||
t.Run(rt, func(t *testing.T) {
|
||||
MaybeParallel(t)
|
||||
|
||||
rt := ContainerRuntime()
|
||||
if rt != "docker" && arm64Platform() {
|
||||
t.Skipf("skipping %s - only docker runtime supported on arm64. See https://github.com/kubernetes/minikube/issues/10144", t.Name())
|
||||
}
|
||||
|
@ -46,7 +42,7 @@ func TestOffline(t *testing.T) {
|
|||
ctx, cancel := context.WithTimeout(context.Background(), Minutes(15))
|
||||
defer CleanupWithLogs(t, profile, cancel)
|
||||
|
||||
startArgs := []string{"start", "-p", profile, "--alsologtostderr", "-v=1", "--memory=2000", "--wait=true", "--container-runtime", rt}
|
||||
startArgs := []string{"start", "-p", profile, "--alsologtostderr", "-v=1", "--memory=2000", "--wait=true"}
|
||||
startArgs = append(startArgs, StartArgs()...)
|
||||
c := exec.CommandContext(ctx, Target(), startArgs...)
|
||||
env := os.Environ()
|
||||
|
@ -60,7 +56,4 @@ func TestOffline(t *testing.T) {
|
|||
// Fatal so that we may collect logs before stop/delete steps
|
||||
t.Fatalf("%s failed: %v", rr.Command(), err)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue