diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index 793345a2b9..5ccae3ca6d 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -976,10 +976,22 @@ func validateCacheCmd(ctx context.Context, t *testing.T, profile string) { t.Skipf("failed to build docker image, skipping local test: %v", err) } + defer func() { + _, err := Run(t, exec.CommandContext(ctx, "docker", "rmi", img)) + if err != nil { + t.Errorf("failed to delete local image %q, err %v", img, err) + } + }() + rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "cache", "add", img)) if err != nil { t.Errorf("failed to 'cache add' local image %q. args %q err %v", img, rr.Command(), err) } + + rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "cache", "delete", img)) + if err != nil { + t.Errorf("failed to 'cache delete' local image %q. args %q err %v", img, rr.Command(), err) + } }) t.Run("delete_k8s.gcr.io/pause:3.3", func(t *testing.T) {