Fix TestPreload on containerd

pull/10423/head
Priya Wadhwa 2021-02-09 11:16:42 -08:00
parent db3bfc3f9e
commit 74161d674b
1 changed files with 14 additions and 3 deletions

View File

@ -49,9 +49,15 @@ func TestPreload(t *testing.T) {
t.Fatalf("%s failed: %v", rr.Command(), err)
}
// Now, pull the busybox image into the VMs docker daemon
// Now, pull the busybox image into minikube
image := "busybox"
rr, err = Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "pull", image))
var cmd *exec.Cmd
if ContainerRuntime() == "docker" {
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "pull", image)
} else {
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "sudo", "crictl", "pull", image)
}
rr, err = Run(t, cmd)
if err != nil {
t.Fatalf("%s failed: %v", rr.Command(), err)
}
@ -65,7 +71,12 @@ func TestPreload(t *testing.T) {
if err != nil {
t.Fatalf("%s failed: %v", rr.Command(), err)
}
rr, err = Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "images"))
if ContainerRuntime() == "docker" {
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "images")
} else {
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "sudo", "crictl", "image", "ls")
}
rr, err = Run(t, cmd)
if err != nil {
t.Fatalf("%s failed: %v", rr.Command(), err)
}