mirror of
https://github.com/moby/buildkit.git
synced 2026-06-30 19:57:39 +00:00
fix trace blob detected as leaked blob in tests
Trace blob is created 3 seconds after build completion. If this happens after test has cleaned all history records and before it checks for leaked blobs, test can report the trace blob as leaked. In practice it would be cleaned up next time containerd GC gets triggered. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@@ -311,6 +311,7 @@ func (c *Controller) ListenBuildHistory(req *controlapi.BuildHistoryRequest, srv
|
||||
|
||||
func (c *Controller) UpdateBuildHistory(ctx context.Context, req *controlapi.UpdateBuildHistoryRequest) (*controlapi.UpdateBuildHistoryResponse, error) {
|
||||
if req.Delete {
|
||||
c.history.Finalize(ctx, req.Ref) // ignore error
|
||||
err := c.history.Delete(ctx, req.Ref)
|
||||
return &controlapi.UpdateBuildHistoryResponse{}, err
|
||||
}
|
||||
|
||||
@@ -115,7 +115,20 @@ func (c *nsFallbackStore) Update(ctx context.Context, info content.Info, fieldpa
|
||||
}
|
||||
|
||||
func (c *nsFallbackStore) Walk(ctx context.Context, fn content.WalkFunc, filters ...string) error {
|
||||
return c.main.Walk(ctx, fn, filters...)
|
||||
seen := make(map[digest.Digest]struct{})
|
||||
err := c.main.Walk(ctx, func(i content.Info) error {
|
||||
seen[i.Digest] = struct{}{}
|
||||
return fn(i)
|
||||
}, filters...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.fb.Walk(ctx, func(i content.Info) error {
|
||||
if _, ok := seen[i.Digest]; ok {
|
||||
return nil
|
||||
}
|
||||
return fn(i)
|
||||
}, filters...)
|
||||
}
|
||||
|
||||
func (c *nsFallbackStore) Delete(ctx context.Context, dgst digest.Digest) error {
|
||||
|
||||
Reference in New Issue
Block a user