mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
lib/model: Fixes on receive-only test setup and pulling (#5136)
This commit is contained in:
parent
ff3cbdc90d
commit
165417c462
@ -7,6 +7,8 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
@ -16,6 +18,7 @@ import (
|
|||||||
"github.com/syncthing/syncthing/lib/db"
|
"github.com/syncthing/syncthing/lib/db"
|
||||||
"github.com/syncthing/syncthing/lib/fs"
|
"github.com/syncthing/syncthing/lib/fs"
|
||||||
"github.com/syncthing/syncthing/lib/protocol"
|
"github.com/syncthing/syncthing/lib/protocol"
|
||||||
|
"github.com/syncthing/syncthing/lib/scanner"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRecvOnlyRevertDeletes(t *testing.T) {
|
func TestRecvOnlyRevertDeletes(t *testing.T) {
|
||||||
@ -244,6 +247,7 @@ func setupKnownFiles(t *testing.T, data []byte) []protocol.FileInfo {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
blocks, _ := scanner.Blocks(context.TODO(), bytes.NewReader(data), protocol.BlockSize(int64(len(data))), int64(len(data)), nil, true)
|
||||||
knownFiles := []protocol.FileInfo{
|
knownFiles := []protocol.FileInfo{
|
||||||
{
|
{
|
||||||
Name: "knownDir",
|
Name: "knownDir",
|
||||||
@ -261,6 +265,7 @@ func setupKnownFiles(t *testing.T, data []byte) []protocol.FileInfo {
|
|||||||
ModifiedNs: int32(fi.ModTime().UnixNano() % 1e9),
|
ModifiedNs: int32(fi.ModTime().UnixNano() % 1e9),
|
||||||
Version: protocol.Vector{Counters: []protocol.Counter{{ID: 42, Value: 42}}},
|
Version: protocol.Vector{Counters: []protocol.Counter{{ID: 42, Value: 42}}},
|
||||||
Sequence: 42,
|
Sequence: 42,
|
||||||
|
Blocks: blocks,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,6 +455,7 @@ nextFile:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !f.checkParent(fi.Name, scanChan) {
|
if !f.checkParent(fi.Name, scanChan) {
|
||||||
|
f.queue.Done(fileName)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user