chore: archive memory and disk limits of 0 mean 0

Signed-off-by: Keith Zantow <keith.zantow@anchore.com>
This commit is contained in:
Keith Zantow
2026-09-30 15:57:48 -04:00
parent d95abbf6b5
commit fda2fe4fcc
7 changed files with 37 additions and 30 deletions
-17
View File
@@ -172,23 +172,6 @@ func Test_archiveCataloger_traversalThreading(t *testing.T) {
}, seen)
}
func Test_archiveCataloger_zeroLimitsMeanDefault(t *testing.T) {
// a config literal naming only the depth must catalog archives, not forbid both memory and disk
rootDir := t.TempDir()
require.NoError(t, os.WriteFile(filepath.Join(rootDir, "outer.zip"), makeZip(t, map[string][]byte{"a.txt": []byte("a")}), 0o600))
var seen []string
fileCounts := map[string]int{}
tsk := newTestTask(t, cataloging.ArchiveSearchConfig{MaxDepth: 1}, capturingTask(t, &seen, &fileCounts))
s := newTestSBOM()
require.NoError(t, tsk.Execute(context.Background(), dirTestResolver{dir: rootDir}, sbomsync.NewBuilder(s)))
assert.Equal(t, []string{"/outer.zip"}, seen)
assert.Equal(t, 1, fileCounts["/outer.zip"])
assert.Empty(t, s.Artifacts.Unknowns)
}
func Test_archiveCataloger_truncationStillCatalogs(t *testing.T) {
// reaching a limit is a truncation, not a failure: the sub-pipeline still runs over what was stored
big := bytes.Repeat([]byte("x"), 4096)