integration: ignore not found error on cleanup

This ignore "not found" errors that may arise during test cleanup. Since
the goal is to make the content "not found", it is okay to skip them and
not fail the test.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day
2017-12-01 15:06:38 -08:00
parent f6df9f6632
commit 0925a88639

View File

@@ -6,6 +6,7 @@ import (
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/content/testsuite"
"github.com/containerd/containerd/errdefs"
"github.com/pkg/errors"
)
@@ -28,7 +29,14 @@ func newContentStore(ctx context.Context, root string) (content.Store, func() er
}
}
return cs.Walk(ctx, func(info content.Info) error {
return cs.Delete(ctx, info.Digest)
if err := cs.Delete(ctx, info.Digest); err != nil {
if errdefs.IsNotFound(err) {
return nil
}
return err
}
return nil
})
}, nil