scanner: Allow disabling weak hash in scanning (fixes #3891)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3905
This commit is contained in:
Audrius Butkevicius
2017-01-23 13:50:32 +00:00
committed by Jakob Borg
parent bd55ec79d2
commit dd78177ae0
10 changed files with 45 additions and 22 deletions

View File

@@ -238,7 +238,7 @@ func TestCopierFinder(t *testing.T) {
}
// Verify that the fetched blocks have actually been written to the temp file
blks, err := scanner.HashFile(tempFile, protocol.BlockSize, nil)
blks, err := scanner.HashFile(tempFile, protocol.BlockSize, nil, false)
if err != nil {
t.Log(err)
}
@@ -291,7 +291,7 @@ func TestWeakHash(t *testing.T) {
// File 1: abcdefgh
// File 2: xyabcdef
f.Seek(0, os.SEEK_SET)
existing, err := scanner.Blocks(f, protocol.BlockSize, size, nil)
existing, err := scanner.Blocks(f, protocol.BlockSize, size, nil, true)
if err != nil {
t.Error(err)
}
@@ -300,7 +300,7 @@ func TestWeakHash(t *testing.T) {
remainder := io.LimitReader(f, size-shift)
prefix := io.LimitReader(rand.Reader, shift)
nf := io.MultiReader(prefix, remainder)
desired, err := scanner.Blocks(nf, protocol.BlockSize, size, nil)
desired, err := scanner.Blocks(nf, protocol.BlockSize, size, nil, true)
if err != nil {
t.Error(err)
}