未验证 提交 36d281db 编写于 作者: M Medya Ghazizadeh 提交者: GitHub

Merge pull request #10542 from medyagh/crio_test_imgload

test: use crictl inspecti for verify images in test
......@@ -174,14 +174,14 @@ func validateLoadImage(ctx context.Context, t *testing.T, profile string) {
busybox := "busybox:latest"
rr, err := Run(t, exec.CommandContext(ctx, "docker", "pull", busybox))
if err != nil {
t.Fatalf("starting minikube: %v\n%s", err, rr.Output())
t.Fatalf("failed to setup test (pull image): %v\n%s", err, rr.Output())
}
// tag busybox
newImage := fmt.Sprintf("busybox:%s", profile)
rr, err = Run(t, exec.CommandContext(ctx, "docker", "tag", busybox, newImage))
if err != nil {
t.Fatalf("starting minikube: %v\n%s", err, rr.Output())
t.Fatalf("failed to setup test (tag image) : %v\n%s", err, rr.Output())
}
// try to load the new image into minikube
......@@ -193,9 +193,14 @@ func validateLoadImage(ctx context.Context, t *testing.T, profile string) {
// make sure the image was correctly loaded
var cmd *exec.Cmd
if ContainerRuntime() == "docker" {
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "images", "--format", "{{.Repository}}:{{.Tag}}")
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "image", "inspect", newImage)
} else if ContainerRuntime() == "containerd" {
// crictl inspecti busybox:test-example
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "sudo", "crictl", "inspecti", newImage)
} else {
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "sudo", "ctr", "-n=k8s.io", "image", "ls")
// crio adds localhost prefix
// crictl inspecti localhost/busybox:test-example
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "sudo", "crictl", "inspecti", "localhost/"+newImage)
}
rr, err = Run(t, cmd)
if err != nil {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册