lib/scanner: Don't report error on missing items (fixes #5385) (#5387)

This commit is contained in:
Simon Frei
2018-12-17 14:52:15 +01:00
committed by GitHub
parent abb3fb8a31
commit c40c9a8d6a
2 changed files with 22 additions and 0 deletions

View File

@@ -738,6 +738,23 @@ func TestIssue4841(t *testing.T) {
}
}
// TestNotExistingError reproduces https://github.com/syncthing/syncthing/issues/5385
func TestNotExistingError(t *testing.T) {
sub := "notExisting"
if _, err := testFs.Lstat(sub); !fs.IsNotExist(err) {
t.Fatalf("Lstat returned error %v, while nothing should exist there.", err)
}
fchan := Walk(context.TODO(), Config{
Filesystem: testFs,
Subs: []string{sub},
Hashers: 2,
})
for f := range fchan {
t.Fatalf("Expected no result from scan, got %v", f)
}
}
// Verify returns nil or an error describing the mismatch between the block
// list and actual reader contents
func verify(r io.Reader, blocksize int, blocks []protocol.BlockInfo) error {