mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 16:06:36 +01:00
Include root path in directory resolve index (#869)
This commit is contained in:
@@ -848,3 +848,20 @@ func testWithTimeout(t *testing.T, timeout time.Duration, test func(*testing.T))
|
||||
case <-done:
|
||||
}
|
||||
}
|
||||
|
||||
func Test_IncludeRootPathInIndex(t *testing.T) {
|
||||
filterFn := func(path string, _ os.FileInfo) bool {
|
||||
return path != "/"
|
||||
}
|
||||
|
||||
resolver, err := newDirectoryResolver("/", filterFn)
|
||||
require.NoError(t, err)
|
||||
|
||||
exists, ref, err := resolver.fileTree.File(file.Path("/"))
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, ref)
|
||||
assert.True(t, exists)
|
||||
|
||||
_, exists = resolver.metadata[ref.ID()]
|
||||
require.True(t, exists)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user