Skip to content

Commit 36d281d

Browse files
authored
Merge pull request #10542 from medyagh/crio_test_imgload
test: use crictl inspecti for verify images in test
2 parents 59c52a2 + 5721cd8 commit 36d281d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/integration/functional_test.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ func validateLoadImage(ctx context.Context, t *testing.T, profile string) {
174174
busybox := "busybox:latest"
175175
rr, err := Run(t, exec.CommandContext(ctx, "docker", "pull", busybox))
176176
if err != nil {
177-
t.Fatalf("starting minikube: %v\n%s", err, rr.Output())
177+
t.Fatalf("failed to setup test (pull image): %v\n%s", err, rr.Output())
178178
}
179179

180180
// tag busybox
181181
newImage := fmt.Sprintf("busybox:%s", profile)
182182
rr, err = Run(t, exec.CommandContext(ctx, "docker", "tag", busybox, newImage))
183183
if err != nil {
184-
t.Fatalf("starting minikube: %v\n%s", err, rr.Output())
184+
t.Fatalf("failed to setup test (tag image) : %v\n%s", err, rr.Output())
185185
}
186186

187187
// try to load the new image into minikube
@@ -193,9 +193,14 @@ func validateLoadImage(ctx context.Context, t *testing.T, profile string) {
193193
// make sure the image was correctly loaded
194194
var cmd *exec.Cmd
195195
if ContainerRuntime() == "docker" {
196-
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "images", "--format", "{{.Repository}}:{{.Tag}}")
196+
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "docker", "image", "inspect", newImage)
197+
} else if ContainerRuntime() == "containerd" {
198+
// crictl inspecti busybox:test-example
199+
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "sudo", "crictl", "inspecti", newImage)
197200
} else {
198-
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "sudo", "ctr", "-n=k8s.io", "image", "ls")
201+
// crio adds localhost prefix
202+
// crictl inspecti localhost/busybox:test-example
203+
cmd = exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "--", "sudo", "crictl", "inspecti", "localhost/"+newImage)
199204
}
200205
rr, err = Run(t, cmd)
201206
if err != nil {

0 commit comments

Comments
 (0)