Include root path in directory resolve index (#869)

This commit is contained in:
Alex Goodman
2022-03-07 11:34:16 -05:00
committed by GitHub
parent a86dd3704e
commit 991af0d857
2 changed files with 35 additions and 1 deletions
+17
View File
@@ -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)
}