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 Jakob Borg
parent b068c8f346
commit 09aff7bb14
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) {
@ -218,6 +221,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",
@ -235,6 +239,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

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