Files
syft/syft/cataloging/archive_search_test.go
T
4b8a3db5f3 Add nested archive cataloging (#5260)
Signed-off-by: Kudryavcev Nikolay <kydry.nikolau@gmail.com>
Signed-off-by: Thomas Bechtold <thomasbechtold@jpberlin.de>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Co-authored-by: Kudryavcev Nikolay <kydry.nikolau@gmail.com>
Co-authored-by: Thomas Bechtold <thomasbechtold@jpberlin.de>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
2026-10-29 17:33:07 -04:00

37 lines
977 B
Go

package cataloging
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDefaultArchiveSearchConfig(t *testing.T) {
cfg := DefaultArchiveSearchConfig()
assert.True(t, cfg.IncludeIndexedArchives)
assert.False(t, cfg.IncludeUnindexedArchives)
assert.Equal(t, DefaultArchiveMaxDepth, cfg.MaxDepth)
assert.Equal(t, int64(DefaultArchiveMaxMemoryBytes), cfg.MaxMemoryBytes)
assert.Equal(t, int64(DefaultArchiveMaxDiskBytes), cfg.MaxDiskBytes)
}
func TestArchiveSearchConfig_WithMethods(t *testing.T) {
cfg := DefaultArchiveSearchConfig()
cfg = cfg.WithMaxDepth(5)
assert.Equal(t, 5, cfg.MaxDepth)
cfg = cfg.WithMaxMemoryBytes(1024)
assert.Equal(t, int64(1024), cfg.MaxMemoryBytes)
cfg = cfg.WithMaxDiskBytes(2048)
assert.Equal(t, int64(2048), cfg.MaxDiskBytes)
cfg = cfg.WithIncludeIndexedArchives(false)
assert.False(t, cfg.IncludeIndexedArchives)
cfg = cfg.WithIncludeUnindexedArchives(true)
assert.True(t, cfg.IncludeUnindexedArchives)
}