lib/model: Fixes on receive-only test setup and pulling (#5136)

This commit is contained in:
Simon Frei 2018-08-19 23:34:26 +02:00 committed by Audrius Butkevicius
parent ff3cbdc90d
commit 165417c462
2 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,8 @@
package model
import (
"bytes"
"context"
"io/ioutil"
"os"
"testing"
@ -16,6 +18,7 @@ import (
"github.com/syncthing/syncthing/lib/db"
"github.com/syncthing/syncthing/lib/fs"
"github.com/syncthing/syncthing/lib/protocol"
"github.com/syncthing/syncthing/lib/scanner"
)
func TestRecvOnlyRevertDeletes(t *testing.T) {
@ -244,6 +247,7 @@ func setupKnownFiles(t *testing.T, data []byte) []protocol.FileInfo {
if err != nil {
t.Fatal(err)
}
blocks, _ := scanner.Blocks(context.TODO(), bytes.NewReader(data), protocol.BlockSize(int64(len(data))), int64(len(data)), nil, true)
knownFiles := []protocol.FileInfo{
{
Name: "knownDir",
@ -261,6 +265,7 @@ func setupKnownFiles(t *testing.T, data []byte) []protocol.FileInfo {
ModifiedNs: int32(fi.ModTime().UnixNano() % 1e9),
Version: protocol.Vector{Counters: []protocol.Counter{{ID: 42, Value: 42}}},
Sequence: 42,
Blocks: blocks,
},
}

View File

@ -455,6 +455,7 @@ nextFile:
}
if !f.checkParent(fi.Name, scanChan) {
f.queue.Done(fileName)
continue
}