lib/fs: Check events against both the user and eval root (#6013)
This commit is contained in:
@@ -166,7 +166,7 @@ func TestWatchWinRoot(t *testing.T) {
|
||||
// testFs is Filesystem, but we need BasicFilesystem here
|
||||
root := `D:\`
|
||||
fs := newBasicFilesystem(root)
|
||||
watch, root, err := fs.watchPaths(".")
|
||||
watch, roots, err := fs.watchPaths(".")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -178,7 +178,7 @@ func TestWatchWinRoot(t *testing.T) {
|
||||
}
|
||||
cancel()
|
||||
}()
|
||||
fs.watchLoop(".", root, backendChan, outChan, errChan, fakeMatcher{}, ctx)
|
||||
fs.watchLoop(".", roots, backendChan, outChan, errChan, fakeMatcher{}, ctx)
|
||||
}()
|
||||
|
||||
// filepath.Dir as watch has a /... suffix
|
||||
@@ -210,7 +210,7 @@ func TestWatchOutside(t *testing.T) {
|
||||
// testFs is Filesystem, but we need BasicFilesystem here
|
||||
fs := newBasicFilesystem(testDirAbs)
|
||||
|
||||
go fs.watchLoop(".", testDirAbs, backendChan, outChan, errChan, fakeMatcher{}, ctx)
|
||||
go fs.watchLoop(".", []string{testDirAbs}, backendChan, outChan, errChan, fakeMatcher{}, ctx)
|
||||
|
||||
backendChan <- fakeEventInfo(filepath.Join(filepath.Dir(testDirAbs), "outside"))
|
||||
|
||||
@@ -234,7 +234,7 @@ func TestWatchSubpath(t *testing.T) {
|
||||
fs := newBasicFilesystem(testDirAbs)
|
||||
|
||||
abs, _ := fs.rooted("sub")
|
||||
go fs.watchLoop("sub", testDirAbs, backendChan, outChan, errChan, fakeMatcher{}, ctx)
|
||||
go fs.watchLoop("sub", []string{testDirAbs}, backendChan, outChan, errChan, fakeMatcher{}, ctx)
|
||||
|
||||
backendChan <- fakeEventInfo(filepath.Join(abs, "file"))
|
||||
|
||||
@@ -347,7 +347,7 @@ func TestWatchSymlinkedRoot(t *testing.T) {
|
||||
|
||||
func TestUnrootedChecked(t *testing.T) {
|
||||
fs := newBasicFilesystem(testDirAbs)
|
||||
if unrooted, err := fs.unrootedChecked("/random/other/path", testDirAbs); err == nil {
|
||||
if unrooted, err := fs.unrootedChecked("/random/other/path", []string{testDirAbs}); err == nil {
|
||||
t.Error("unrootedChecked did not return an error on outside path, but returned", unrooted)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user