diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-06-01 14:51:40 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-06-02 13:28:24 +0900 |
| commit | fbd2329d50a9ef2b15c0a6b62e9aa24635c2662a (patch) | |
| tree | 2c8b0c8c8d16412681c9e758e9121dab022cc008 /internal/pkg/pkg_test.go | |
| parent | f398f71fa947dbf03587b1a28d314a969aa6b351 (diff) | |
internal/pkg: garbage collection
This destroys cache entries not referred to by user-specified artifacts and optionally their inputs.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/pkg_test.go')
| -rw-r--r-- | internal/pkg/pkg_test.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go index d5c92a6d..a4fb8361 100644 --- a/internal/pkg/pkg_test.go +++ b/internal/pkg/pkg_test.go @@ -486,7 +486,17 @@ func checkWithCache(t *testing.T, testCases []cacheTestCase) { tc.early(t, base) } tc.f(t, base, c) - scrubFunc = func() error { return c.Scrub(1 << 7) } + scrubFunc = func() error { + err = c.Scrub(1 << 7) + idents, checksums, cleanErr := c.Clean(false, false) + if len(idents) > 0 { + t.Errorf("destroyed %d idents", len(idents)) + } + if len(checksums) > 0 { + t.Errorf("destroyed %d checksums", len(checksums)) + } + return errors.Join(err, cleanErr) + } } var restoreTemp bool @@ -561,10 +571,7 @@ func checkWithCache(t *testing.T, testCases []cacheTestCase) { if err := pkg.HashDir(&checksum, base); err != nil { t.Fatalf("HashDir: error = %v", err) } else if checksum != want { - t.Fatalf("(scrubbed) HashDir: %v", &pkg.ChecksumMismatchError{ - Got: checksum, - Want: want, - }) + t.Fatalf("(scrubbed) %s", expectsFrom(base.String())) } }) } |
