diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index a21ec2a56b..77212b63fa 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -323,7 +323,7 @@ func validateCacheCmd(ctx context.Context, t *testing.T, profile string) { } } }) - t.Run("delete", func(t *testing.T) { + t.Run("delete busybox:1.28.4-glibc", func(t *testing.T) { _, err := Run(t, exec.CommandContext(ctx, Target(), "cache", "delete", "busybox:1.28.4-glibc")) if err != nil { t.Errorf("failed to delete image busybox:1.28.4-glibc from cache: %v", err) @@ -346,13 +346,38 @@ func validateCacheCmd(ctx context.Context, t *testing.T, profile string) { t.Run("verify cache inside node", func(t *testing.T) { rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "sudo", "crictl", "images")) if err != nil { - t.Errorf("failed to get docker images through ssh %v", err) + t.Errorf("failed to get images by %q ssh %v", rr.Command(), err) } if !strings.Contains(rr.Output(), "1.28.4-glibc") { t.Errorf("expected '1.28.4-glibc' to be in the output: %s", rr.Output()) } }) + + t.Run("reload", func(t *testing.T) { // deleting image inside minikube node manually and expecting reload to bring it back + img := "busybox:latest" + // deleting image inside minikube node manually + rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "sudo", "crictl", "rmi", img)) + if err != nil { + t.Errorf("failed to delete inside the node %q : %v", rr.Command(), err) + } + // make sure the image is deleted. + rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "sudo", "crictl", "inspecti", img)) + if err == nil { + t.Errorf("expected the image be deleted and get error but got nil error ! cmd: %q", rr.Command()) + } + + // minikube cache reload + rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "cache", "reload")) + if err != nil { + t.Errorf("failed to cache reload %v", rr.Command(), err) + } + rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "ssh", "sudo", "crictl", "inspecti", img)) + if err != nil { + t.Errorf("expected to get no error for %q but got %v", rr.Command(), err) + } + }) + }) }