mirror of
https://github.com/anchore/syft.git
synced 2026-11-06 17:34:21 +01:00
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>
37 lines
977 B
Go
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)
|
|
}
|