mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-18 19:15:19 +00:00
test, lib/model: Various integration test updates & improvements (#6956)
This commit is contained in:
parent
52d1681fe6
commit
3dd13c3994
@ -1031,11 +1031,13 @@ func (f *folder) updateLocals(fs []protocol.FileInfo) {
|
|||||||
}
|
}
|
||||||
f.forcedRescanPathsMut.Unlock()
|
f.forcedRescanPathsMut.Unlock()
|
||||||
|
|
||||||
|
seq := f.fset.Sequence(protocol.LocalDeviceID)
|
||||||
f.evLogger.Log(events.LocalIndexUpdated, map[string]interface{}{
|
f.evLogger.Log(events.LocalIndexUpdated, map[string]interface{}{
|
||||||
"folder": f.ID,
|
"folder": f.ID,
|
||||||
"items": len(fs),
|
"items": len(fs),
|
||||||
"filenames": filenames,
|
"filenames": filenames,
|
||||||
"version": f.fset.Sequence(protocol.LocalDeviceID),
|
"sequence": seq,
|
||||||
|
"version": seq, // legacy for sequence
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,15 +715,17 @@ type FolderCompletion struct {
|
|||||||
GlobalItems int32
|
GlobalItems int32
|
||||||
NeedItems int32
|
NeedItems int32
|
||||||
NeedDeletes int32
|
NeedDeletes int32
|
||||||
|
Sequence int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFolderCompletion(global, need db.Counts) FolderCompletion {
|
func newFolderCompletion(global, need db.Counts, sequence int64) FolderCompletion {
|
||||||
comp := FolderCompletion{
|
comp := FolderCompletion{
|
||||||
GlobalBytes: global.Bytes,
|
GlobalBytes: global.Bytes,
|
||||||
NeedBytes: need.Bytes,
|
NeedBytes: need.Bytes,
|
||||||
GlobalItems: global.Files + global.Directories + global.Symlinks,
|
GlobalItems: global.Files + global.Directories + global.Symlinks,
|
||||||
NeedItems: need.Files + need.Directories + need.Symlinks,
|
NeedItems: need.Files + need.Directories + need.Symlinks,
|
||||||
NeedDeletes: need.Deleted,
|
NeedDeletes: need.Deleted,
|
||||||
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
comp.setComplectionPct()
|
comp.setComplectionPct()
|
||||||
return comp
|
return comp
|
||||||
@ -764,6 +766,7 @@ func (comp FolderCompletion) Map() map[string]interface{} {
|
|||||||
"globalItems": comp.GlobalItems,
|
"globalItems": comp.GlobalItems,
|
||||||
"needItems": comp.NeedItems,
|
"needItems": comp.NeedItems,
|
||||||
"needDeletes": comp.NeedDeletes,
|
"needDeletes": comp.NeedDeletes,
|
||||||
|
"sequence": comp.Sequence,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,7 +827,7 @@ func (m *model) folderCompletion(device protocol.DeviceID, folder string) Folder
|
|||||||
need.Bytes = 0
|
need.Bytes = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
comp := newFolderCompletion(global, need)
|
comp := newFolderCompletion(global, need, snap.Sequence(device))
|
||||||
|
|
||||||
l.Debugf("%v Completion(%s, %q): %v", m, device, folder, comp.Map())
|
l.Debugf("%v Completion(%s, %q): %v", m, device, folder, comp.Map())
|
||||||
return comp
|
return comp
|
||||||
@ -974,11 +977,13 @@ func (m *model) handleIndex(deviceID protocol.DeviceID, folder string, fs []prot
|
|||||||
}
|
}
|
||||||
files.Update(deviceID, fs)
|
files.Update(deviceID, fs)
|
||||||
|
|
||||||
|
seq := files.Sequence(deviceID)
|
||||||
m.evLogger.Log(events.RemoteIndexUpdated, map[string]interface{}{
|
m.evLogger.Log(events.RemoteIndexUpdated, map[string]interface{}{
|
||||||
"device": deviceID.String(),
|
"device": deviceID.String(),
|
||||||
"folder": folder,
|
"folder": folder,
|
||||||
"items": len(fs),
|
"items": len(fs),
|
||||||
"version": files.Sequence(deviceID),
|
"sequence": seq,
|
||||||
|
"version": seq, // legacy for sequence
|
||||||
})
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -3929,16 +3929,16 @@ func TestConnectionTerminationOnFolderUnpause(t *testing.T) {
|
|||||||
|
|
||||||
func TestAddFolderCompletion(t *testing.T) {
|
func TestAddFolderCompletion(t *testing.T) {
|
||||||
// Empty folders are always 100% complete.
|
// Empty folders are always 100% complete.
|
||||||
comp := newFolderCompletion(db.Counts{}, db.Counts{})
|
comp := newFolderCompletion(db.Counts{}, db.Counts{}, 0)
|
||||||
comp.add(newFolderCompletion(db.Counts{}, db.Counts{}))
|
comp.add(newFolderCompletion(db.Counts{}, db.Counts{}, 0))
|
||||||
if comp.CompletionPct != 100 {
|
if comp.CompletionPct != 100 {
|
||||||
t.Error(comp.CompletionPct)
|
t.Error(comp.CompletionPct)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Completion is of the whole
|
// Completion is of the whole
|
||||||
comp = newFolderCompletion(db.Counts{Bytes: 100}, db.Counts{}) // 100% complete
|
comp = newFolderCompletion(db.Counts{Bytes: 100}, db.Counts{}, 0) // 100% complete
|
||||||
comp.add(newFolderCompletion(db.Counts{Bytes: 400}, db.Counts{Bytes: 50})) // 82.5% complete
|
comp.add(newFolderCompletion(db.Counts{Bytes: 400}, db.Counts{Bytes: 50}, 0)) // 82.5% complete
|
||||||
if comp.CompletionPct != 90 { // 100 * (1 - 50/500)
|
if comp.CompletionPct != 90 { // 100 * (1 - 50/500)
|
||||||
t.Error(comp.CompletionPct)
|
t.Error(comp.CompletionPct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
61
lib/rc/rc.go
61
lib/rc/rc.go
@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/syncthing/syncthing/lib/config"
|
"github.com/syncthing/syncthing/lib/config"
|
||||||
"github.com/syncthing/syncthing/lib/dialer"
|
"github.com/syncthing/syncthing/lib/dialer"
|
||||||
"github.com/syncthing/syncthing/lib/events"
|
"github.com/syncthing/syncthing/lib/events"
|
||||||
|
"github.com/syncthing/syncthing/lib/model"
|
||||||
"github.com/syncthing/syncthing/lib/protocol"
|
"github.com/syncthing/syncthing/lib/protocol"
|
||||||
"github.com/syncthing/syncthing/lib/sync"
|
"github.com/syncthing/syncthing/lib/sync"
|
||||||
)
|
)
|
||||||
@ -539,19 +540,8 @@ func (p *Process) eventLoop() {
|
|||||||
case "LocalIndexUpdated":
|
case "LocalIndexUpdated":
|
||||||
data := ev.Data.(map[string]interface{})
|
data := ev.Data.(map[string]interface{})
|
||||||
folder := data["folder"].(string)
|
folder := data["folder"].(string)
|
||||||
version, _ := data["version"].(json.Number).Int64()
|
|
||||||
p.eventMut.Lock()
|
p.eventMut.Lock()
|
||||||
m := p.sequence[folder]
|
m := p.updateSequenceLocked(folder, p.id.String(), data["sequence"])
|
||||||
if m == nil {
|
|
||||||
m = make(map[string]int64)
|
|
||||||
}
|
|
||||||
device := p.id.String()
|
|
||||||
if device == "" {
|
|
||||||
p.eventMut.Unlock()
|
|
||||||
panic("race, or startup not complete")
|
|
||||||
}
|
|
||||||
m[device] = version
|
|
||||||
p.sequence[folder] = m
|
|
||||||
p.done[folder] = false
|
p.done[folder] = false
|
||||||
l.Debugf("LocalIndexUpdated %v %v done=false\n\t%+v", p.id, folder, m)
|
l.Debugf("LocalIndexUpdated %v %v done=false\n\t%+v", p.id, folder, m)
|
||||||
p.eventMut.Unlock()
|
p.eventMut.Unlock()
|
||||||
@ -560,14 +550,8 @@ func (p *Process) eventLoop() {
|
|||||||
data := ev.Data.(map[string]interface{})
|
data := ev.Data.(map[string]interface{})
|
||||||
device := data["device"].(string)
|
device := data["device"].(string)
|
||||||
folder := data["folder"].(string)
|
folder := data["folder"].(string)
|
||||||
version, _ := data["version"].(json.Number).Int64()
|
|
||||||
p.eventMut.Lock()
|
p.eventMut.Lock()
|
||||||
m := p.sequence[folder]
|
m := p.updateSequenceLocked(folder, device, data["sequence"])
|
||||||
if m == nil {
|
|
||||||
m = make(map[string]int64)
|
|
||||||
}
|
|
||||||
m[device] = version
|
|
||||||
p.sequence[folder] = m
|
|
||||||
p.done[folder] = false
|
p.done[folder] = false
|
||||||
l.Debugf("RemoteIndexUpdated %v %v done=false\n\t%+v", p.id, folder, m)
|
l.Debugf("RemoteIndexUpdated %v %v done=false\n\t%+v", p.id, folder, m)
|
||||||
p.eventMut.Unlock()
|
p.eventMut.Unlock()
|
||||||
@ -576,17 +560,38 @@ func (p *Process) eventLoop() {
|
|||||||
data := ev.Data.(map[string]interface{})
|
data := ev.Data.(map[string]interface{})
|
||||||
folder := data["folder"].(string)
|
folder := data["folder"].(string)
|
||||||
summary := data["summary"].(map[string]interface{})
|
summary := data["summary"].(map[string]interface{})
|
||||||
need, _ := summary["needBytes"].(json.Number).Int64()
|
need, _ := summary["needTotalItems"].(json.Number).Int64()
|
||||||
done := need == 0
|
done := need == 0
|
||||||
p.eventMut.Lock()
|
p.eventMut.Lock()
|
||||||
|
m := p.updateSequenceLocked(folder, p.id.String(), summary["sequence"])
|
||||||
p.done[folder] = done
|
p.done[folder] = done
|
||||||
l.Debugf("Foldersummary %v %v\n\t%+v", p.id, folder, p.done)
|
l.Debugf("FolderSummary %v %v\n\t%+v\n\t%+v", p.id, folder, p.done, m)
|
||||||
|
p.eventMut.Unlock()
|
||||||
|
|
||||||
|
case "FolderCompletion":
|
||||||
|
data := ev.Data.(map[string]interface{})
|
||||||
|
device := data["device"].(string)
|
||||||
|
folder := data["folder"].(string)
|
||||||
|
p.eventMut.Lock()
|
||||||
|
m := p.updateSequenceLocked(folder, device, data["sequence"])
|
||||||
|
l.Debugf("FolderCompletion %v\n\t%+v", p.id, folder, m)
|
||||||
p.eventMut.Unlock()
|
p.eventMut.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Process) updateSequenceLocked(folder, device string, sequenceIntf interface{}) map[string]int64 {
|
||||||
|
sequence, _ := sequenceIntf.(json.Number).Int64()
|
||||||
|
m := p.sequence[folder]
|
||||||
|
if m == nil {
|
||||||
|
m = make(map[string]int64)
|
||||||
|
}
|
||||||
|
m[device] = sequence
|
||||||
|
p.sequence[folder] = m
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
type ConnectionStats struct {
|
type ConnectionStats struct {
|
||||||
Address string
|
Address string
|
||||||
Type string
|
Type string
|
||||||
@ -658,3 +663,17 @@ func (p *Process) SystemVersion() (SystemVersion, error) {
|
|||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Process) RemoteInSync(folder string, dev protocol.DeviceID) (bool, error) {
|
||||||
|
bs, err := p.Get(fmt.Sprintf("/rest/db/completion?folder=%v&device=%v", url.QueryEscape(folder), dev))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var comp model.FolderCompletion
|
||||||
|
if err := json.Unmarshal(bs, &comp); err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return comp.NeedItems+comp.NeedDeletes == 0, nil
|
||||||
|
}
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
func TestFileTypeChange(t *testing.T) {
|
func TestFileTypeChange(t *testing.T) {
|
||||||
// Use no versioning
|
// Use no versioning
|
||||||
id, _ := protocol.DeviceIDFromString(id2)
|
id, _ := protocol.DeviceIDFromString(id2)
|
||||||
cfg, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
cfg, _, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
||||||
fld := cfg.Folders()["default"]
|
fld := cfg.Folders()["default"]
|
||||||
fld.Versioning = config.VersioningConfiguration{}
|
fld.Versioning = config.VersioningConfiguration{}
|
||||||
cfg.SetFolder(fld)
|
cfg.SetFolder(fld)
|
||||||
@ -36,7 +36,7 @@ func TestFileTypeChange(t *testing.T) {
|
|||||||
func TestFileTypeChangeSimpleVersioning(t *testing.T) {
|
func TestFileTypeChangeSimpleVersioning(t *testing.T) {
|
||||||
// Use simple versioning
|
// Use simple versioning
|
||||||
id, _ := protocol.DeviceIDFromString(id2)
|
id, _ := protocol.DeviceIDFromString(id2)
|
||||||
cfg, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
cfg, _, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
||||||
fld := cfg.Folders()["default"]
|
fld := cfg.Folders()["default"]
|
||||||
fld.Versioning = config.VersioningConfiguration{
|
fld.Versioning = config.VersioningConfiguration{
|
||||||
Type: "simple",
|
Type: "simple",
|
||||||
@ -53,7 +53,7 @@ func TestFileTypeChangeSimpleVersioning(t *testing.T) {
|
|||||||
func TestFileTypeChangeStaggeredVersioning(t *testing.T) {
|
func TestFileTypeChangeStaggeredVersioning(t *testing.T) {
|
||||||
// Use staggered versioning
|
// Use staggered versioning
|
||||||
id, _ := protocol.DeviceIDFromString(id2)
|
id, _ := protocol.DeviceIDFromString(id2)
|
||||||
cfg, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
cfg, _, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
||||||
fld := cfg.Folders()["default"]
|
fld := cfg.Folders()["default"]
|
||||||
fld.Versioning = config.VersioningConfiguration{
|
fld.Versioning = config.VersioningConfiguration{
|
||||||
Type: "staggered",
|
Type: "staggered",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<configuration version="31">
|
<configuration version="32">
|
||||||
<folder id="default" label="" path="s1/" type="sendreceive" rescanIntervalS="10" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
<folder id="default" label="" path="s1/" type="sendreceive" rescanIntervalS="10" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
||||||
@ -6,7 +6,9 @@
|
|||||||
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" introducedBy=""></device>
|
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" introducedBy=""></device>
|
||||||
<device id="7PBCTLL-JJRYBSA-MOWZRKL-MSDMN4N-4US4OMX-SYEXUS4-HSBGNRY-CZXRXAT" introducedBy=""></device>
|
<device id="7PBCTLL-JJRYBSA-MOWZRKL-MSDMN4N-4US4OMX-SYEXUS4-HSBGNRY-CZXRXAT" introducedBy=""></device>
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning></versioning>
|
<versioning>
|
||||||
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
</versioning>
|
||||||
<copiers>1</copiers>
|
<copiers>1</copiers>
|
||||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||||
<hashers>0</hashers>
|
<hashers>0</hashers>
|
||||||
@ -25,13 +27,18 @@
|
|||||||
<maxConcurrentWrites>0</maxConcurrentWrites>
|
<maxConcurrentWrites>0</maxConcurrentWrites>
|
||||||
<disableFsync>false</disableFsync>
|
<disableFsync>false</disableFsync>
|
||||||
<blockPullOrder>standard</blockPullOrder>
|
<blockPullOrder>standard</blockPullOrder>
|
||||||
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
|
<junctionsAsDirs>true</junctionsAsDirs>
|
||||||
</folder>
|
</folder>
|
||||||
<folder id="¯\_(ツ)_/¯ Räksmörgås 动作 Адрес" label="" path="s12-1/" type="sendreceive" rescanIntervalS="10" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
<folder id="¯\_(ツ)_/¯ Räksmörgås 动作 Адрес" label="" path="s12-1/" type="sendreceive" rescanIntervalS="10" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
||||||
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning></versioning>
|
<versioning>
|
||||||
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
</versioning>
|
||||||
<copiers>1</copiers>
|
<copiers>1</copiers>
|
||||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||||
<hashers>0</hashers>
|
<hashers>0</hashers>
|
||||||
@ -50,6 +57,9 @@
|
|||||||
<maxConcurrentWrites>0</maxConcurrentWrites>
|
<maxConcurrentWrites>0</maxConcurrentWrites>
|
||||||
<disableFsync>false</disableFsync>
|
<disableFsync>false</disableFsync>
|
||||||
<blockPullOrder>standard</blockPullOrder>
|
<blockPullOrder>standard</blockPullOrder>
|
||||||
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
|
<junctionsAsDirs>true</junctionsAsDirs>
|
||||||
</folder>
|
</folder>
|
||||||
<device id="EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK" name="s4" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
<device id="EJHMPAQ-OGCVORE-ISB4IS3-SYYVJXF-TKJGLTU-66DIQPF-GJ5D2GX-GQ3OWQK" name="s4" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
||||||
<address>tcp://127.0.0.1:22004</address>
|
<address>tcp://127.0.0.1:22004</address>
|
||||||
@ -144,5 +154,6 @@
|
|||||||
<stunServer>default</stunServer>
|
<stunServer>default</stunServer>
|
||||||
<databaseTuning>auto</databaseTuning>
|
<databaseTuning>auto</databaseTuning>
|
||||||
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
|
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
|
||||||
|
<announceLANAddresses>true</announceLANAddresses>
|
||||||
</options>
|
</options>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
<configuration version="29">
|
<configuration version="32">
|
||||||
<folder id="default" label="" path="s2" type="sendreceive" rescanIntervalS="15" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
<folder id="default" label="" path="s2" type="sendreceive" rescanIntervalS="15" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
||||||
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
||||||
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" introducedBy=""></device>
|
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" introducedBy=""></device>
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning></versioning>
|
<versioning>
|
||||||
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
</versioning>
|
||||||
<copiers>1</copiers>
|
<copiers>1</copiers>
|
||||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||||
<hashers>0</hashers>
|
<hashers>0</hashers>
|
||||||
@ -24,13 +26,18 @@
|
|||||||
<maxConcurrentWrites>0</maxConcurrentWrites>
|
<maxConcurrentWrites>0</maxConcurrentWrites>
|
||||||
<disableFsync>false</disableFsync>
|
<disableFsync>false</disableFsync>
|
||||||
<blockPullOrder>standard</blockPullOrder>
|
<blockPullOrder>standard</blockPullOrder>
|
||||||
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
|
<junctionsAsDirs>true</junctionsAsDirs>
|
||||||
</folder>
|
</folder>
|
||||||
<folder id="s23" label="" path="s23-2" type="sendreceive" rescanIntervalS="15" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
<folder id="s23" label="" path="s23-2" type="sendreceive" rescanIntervalS="15" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
||||||
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" introducedBy=""></device>
|
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" introducedBy=""></device>
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning></versioning>
|
<versioning>
|
||||||
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
</versioning>
|
||||||
<copiers>1</copiers>
|
<copiers>1</copiers>
|
||||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||||
<hashers>0</hashers>
|
<hashers>0</hashers>
|
||||||
@ -49,13 +56,18 @@
|
|||||||
<maxConcurrentWrites>0</maxConcurrentWrites>
|
<maxConcurrentWrites>0</maxConcurrentWrites>
|
||||||
<disableFsync>false</disableFsync>
|
<disableFsync>false</disableFsync>
|
||||||
<blockPullOrder>standard</blockPullOrder>
|
<blockPullOrder>standard</blockPullOrder>
|
||||||
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
|
<junctionsAsDirs>true</junctionsAsDirs>
|
||||||
</folder>
|
</folder>
|
||||||
<folder id="¯\_(ツ)_/¯ Räksmörgås 动作 Адрес" label="" path="s12-2" type="sendreceive" rescanIntervalS="15" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
<folder id="¯\_(ツ)_/¯ Räksmörgås 动作 Адрес" label="" path="s12-2" type="sendreceive" rescanIntervalS="15" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
||||||
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning></versioning>
|
<versioning>
|
||||||
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
</versioning>
|
||||||
<copiers>1</copiers>
|
<copiers>1</copiers>
|
||||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||||
<hashers>0</hashers>
|
<hashers>0</hashers>
|
||||||
@ -74,6 +86,9 @@
|
|||||||
<maxConcurrentWrites>0</maxConcurrentWrites>
|
<maxConcurrentWrites>0</maxConcurrentWrites>
|
||||||
<disableFsync>false</disableFsync>
|
<disableFsync>false</disableFsync>
|
||||||
<blockPullOrder>standard</blockPullOrder>
|
<blockPullOrder>standard</blockPullOrder>
|
||||||
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
|
<junctionsAsDirs>true</junctionsAsDirs>
|
||||||
</folder>
|
</folder>
|
||||||
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
||||||
<address>tcp://127.0.0.1:22001</address>
|
<address>tcp://127.0.0.1:22001</address>
|
||||||
@ -151,5 +166,6 @@
|
|||||||
<stunServer>default</stunServer>
|
<stunServer>default</stunServer>
|
||||||
<databaseTuning>auto</databaseTuning>
|
<databaseTuning>auto</databaseTuning>
|
||||||
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
|
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
|
||||||
|
<announceLANAddresses>true</announceLANAddresses>
|
||||||
</options>
|
</options>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<configuration version="31">
|
<configuration version="32">
|
||||||
<folder id="default" label="" path="s3" type="sendreceive" rescanIntervalS="20" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
<folder id="default" label="" path="s3" type="sendreceive" rescanIntervalS="20" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy=""></device>
|
||||||
@ -7,6 +7,7 @@
|
|||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning type="simple">
|
<versioning type="simple">
|
||||||
<param key="keep" val="5"></param>
|
<param key="keep" val="5"></param>
|
||||||
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
</versioning>
|
</versioning>
|
||||||
<copiers>1</copiers>
|
<copiers>1</copiers>
|
||||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||||
@ -26,13 +27,18 @@
|
|||||||
<maxConcurrentWrites>0</maxConcurrentWrites>
|
<maxConcurrentWrites>0</maxConcurrentWrites>
|
||||||
<disableFsync>false</disableFsync>
|
<disableFsync>false</disableFsync>
|
||||||
<blockPullOrder>standard</blockPullOrder>
|
<blockPullOrder>standard</blockPullOrder>
|
||||||
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
|
<junctionsAsDirs>true</junctionsAsDirs>
|
||||||
</folder>
|
</folder>
|
||||||
<folder id="s23" label="" path="s23-3" type="sendreceive" rescanIntervalS="20" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
<folder id="s23" label="" path="s23-3" type="sendreceive" rescanIntervalS="20" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
<device id="MRIW7OK-NETT3M4-N6SBWME-N25O76W-YJKVXPH-FUMQJ3S-P57B74J-GBITBAC" introducedBy=""></device>
|
||||||
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" introducedBy=""></device>
|
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU" introducedBy=""></device>
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning></versioning>
|
<versioning>
|
||||||
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
</versioning>
|
||||||
<copiers>1</copiers>
|
<copiers>1</copiers>
|
||||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||||
<hashers>0</hashers>
|
<hashers>0</hashers>
|
||||||
@ -51,6 +57,9 @@
|
|||||||
<maxConcurrentWrites>0</maxConcurrentWrites>
|
<maxConcurrentWrites>0</maxConcurrentWrites>
|
||||||
<disableFsync>false</disableFsync>
|
<disableFsync>false</disableFsync>
|
||||||
<blockPullOrder>standard</blockPullOrder>
|
<blockPullOrder>standard</blockPullOrder>
|
||||||
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
|
<junctionsAsDirs>true</junctionsAsDirs>
|
||||||
</folder>
|
</folder>
|
||||||
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
||||||
<address>tcp://127.0.0.1:22001</address>
|
<address>tcp://127.0.0.1:22001</address>
|
||||||
@ -128,5 +137,6 @@
|
|||||||
<stunServer>default</stunServer>
|
<stunServer>default</stunServer>
|
||||||
<databaseTuning>auto</databaseTuning>
|
<databaseTuning>auto</databaseTuning>
|
||||||
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
|
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
|
||||||
|
<announceLANAddresses>true</announceLANAddresses>
|
||||||
</options>
|
</options>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
<configuration version="28">
|
<configuration version="32">
|
||||||
<folder id="default" label="" path="s4/" type="readwrite" rescanIntervalS="60" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="false">
|
<folder id="default" label="" path="s4/" type="sendreceive" rescanIntervalS="60" fsWatcherEnabled="false" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="false">
|
||||||
<filesystemType>basic</filesystemType>
|
<filesystemType>basic</filesystemType>
|
||||||
<device id="7PBCTLL-JJRYBSA-MOWZRKL-MSDMN4N-4US4OMX-SYEXUS4-HSBGNRY-CZXRXAT" introducedBy=""></device>
|
<device id="7PBCTLL-JJRYBSA-MOWZRKL-MSDMN4N-4US4OMX-SYEXUS4-HSBGNRY-CZXRXAT" introducedBy=""></device>
|
||||||
<minDiskFree unit="%">1</minDiskFree>
|
<minDiskFree unit="%">1</minDiskFree>
|
||||||
<versioning></versioning>
|
<versioning>
|
||||||
|
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||||
|
</versioning>
|
||||||
<copiers>1</copiers>
|
<copiers>1</copiers>
|
||||||
<pullerMaxPendingKiB>2048</pullerMaxPendingKiB>
|
<pullerMaxPendingKiB>2048</pullerMaxPendingKiB>
|
||||||
<hashers>0</hashers>
|
<hashers>0</hashers>
|
||||||
@ -17,7 +19,14 @@
|
|||||||
<paused>false</paused>
|
<paused>false</paused>
|
||||||
<weakHashThresholdPct>25</weakHashThresholdPct>
|
<weakHashThresholdPct>25</weakHashThresholdPct>
|
||||||
<markerName>.stfolder</markerName>
|
<markerName>.stfolder</markerName>
|
||||||
<useLargeBlocks>false</useLargeBlocks>
|
<copyOwnershipFromParent>false</copyOwnershipFromParent>
|
||||||
|
<modTimeWindowS>0</modTimeWindowS>
|
||||||
|
<maxConcurrentWrites>0</maxConcurrentWrites>
|
||||||
|
<disableFsync>false</disableFsync>
|
||||||
|
<blockPullOrder>standard</blockPullOrder>
|
||||||
|
<copyRangeMethod>standard</copyRangeMethod>
|
||||||
|
<caseSensitiveFS>false</caseSensitiveFS>
|
||||||
|
<junctionsAsDirs>true</junctionsAsDirs>
|
||||||
</folder>
|
</folder>
|
||||||
<device id="7PBCTLL-JJRYBSA-MOWZRKL-MSDMN4N-4US4OMX-SYEXUS4-HSBGNRY-CZXRXAT" name="s4" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
<device id="7PBCTLL-JJRYBSA-MOWZRKL-MSDMN4N-4US4OMX-SYEXUS4-HSBGNRY-CZXRXAT" name="s4" compression="metadata" introducer="false" skipIntroductionRemovals="false" introducedBy="">
|
||||||
<address>dynamic</address>
|
<address>dynamic</address>
|
||||||
@ -25,12 +34,14 @@
|
|||||||
<autoAcceptFolders>false</autoAcceptFolders>
|
<autoAcceptFolders>false</autoAcceptFolders>
|
||||||
<maxSendKbps>0</maxSendKbps>
|
<maxSendKbps>0</maxSendKbps>
|
||||||
<maxRecvKbps>0</maxRecvKbps>
|
<maxRecvKbps>0</maxRecvKbps>
|
||||||
|
<maxRequestKiB>0</maxRequestKiB>
|
||||||
</device>
|
</device>
|
||||||
<gui enabled="true" tls="false" debugging="true">
|
<gui enabled="true" tls="false" debugging="true">
|
||||||
<address>127.0.0.1:8084</address>
|
<address>127.0.0.1:8084</address>
|
||||||
<apikey>PMA5yUTG-Mw98nJ0YEtWTCHlM5O4aNi0</apikey>
|
<apikey>PMA5yUTG-Mw98nJ0YEtWTCHlM5O4aNi0</apikey>
|
||||||
<theme>default</theme>
|
<theme>default</theme>
|
||||||
</gui>
|
</gui>
|
||||||
|
<ldap></ldap>
|
||||||
<options>
|
<options>
|
||||||
<listenAddress>dynamic+https://relays.syncthing.net/endpoint</listenAddress>
|
<listenAddress>dynamic+https://relays.syncthing.net/endpoint</listenAddress>
|
||||||
<listenAddress>tcp://127.0.0.1:22004</listenAddress>
|
<listenAddress>tcp://127.0.0.1:22004</listenAddress>
|
||||||
@ -69,6 +80,14 @@
|
|||||||
<trafficClass>0</trafficClass>
|
<trafficClass>0</trafficClass>
|
||||||
<defaultFolderPath>~</defaultFolderPath>
|
<defaultFolderPath>~</defaultFolderPath>
|
||||||
<setLowPriority>true</setLowPriority>
|
<setLowPriority>true</setLowPriority>
|
||||||
<minHomeDiskFreePct>0</minHomeDiskFreePct>
|
<maxFolderConcurrency>0</maxFolderConcurrency>
|
||||||
|
<crashReportingURL>https://crash.syncthing.net/newcrash</crashReportingURL>
|
||||||
|
<crashReportingEnabled>true</crashReportingEnabled>
|
||||||
|
<stunKeepaliveStartS>180</stunKeepaliveStartS>
|
||||||
|
<stunKeepaliveMinS>20</stunKeepaliveMinS>
|
||||||
|
<stunServer>default</stunServer>
|
||||||
|
<databaseTuning>auto</databaseTuning>
|
||||||
|
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
|
||||||
|
<announceLANAddresses>true</announceLANAddresses>
|
||||||
</options>
|
</options>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
func TestOverride(t *testing.T) {
|
func TestOverride(t *testing.T) {
|
||||||
// Enable "send-only" on s1/default
|
// Enable "send-only" on s1/default
|
||||||
id, _ := protocol.DeviceIDFromString(id1)
|
id, _ := protocol.DeviceIDFromString(id1)
|
||||||
cfg, _ := config.Load("h1/config.xml", id, events.NoopLogger)
|
cfg, _, _ := config.Load("h1/config.xml", id, events.NoopLogger)
|
||||||
fld := cfg.Folders()["default"]
|
fld := cfg.Folders()["default"]
|
||||||
fld.Type = config.FolderTypeSendOnly
|
fld.Type = config.FolderTypeSendOnly
|
||||||
cfg.SetFolder(fld)
|
cfg.SetFolder(fld)
|
||||||
@ -157,7 +157,7 @@ get to completion when in sendOnly/sendRecv mode. Needs fixing.
|
|||||||
func TestOverrideIgnores(t *testing.T) {
|
func TestOverrideIgnores(t *testing.T) {
|
||||||
// Enable "sendOnly" on s1/default
|
// Enable "sendOnly" on s1/default
|
||||||
id, _ := protocol.DeviceIDFromString(id1)
|
id, _ := protocol.DeviceIDFromString(id1)
|
||||||
cfg, _ := config.Load("h1/config.xml", id, events.NoopLogger)
|
cfg, _, _ := config.Load("h1/config.xml", id, events.NoopLogger)
|
||||||
fld := cfg.Folders()["default"]
|
fld := cfg.Folders()["default"]
|
||||||
fld.ReadOnly = true
|
fld.ReadOnly = true
|
||||||
cfg.SetFolder(fld)
|
cfg.SetFolder(fld)
|
||||||
|
@ -12,6 +12,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/syncthing/syncthing/lib/rc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestReconnectReceiverDuringTransfer(t *testing.T) {
|
func TestReconnectReceiverDuringTransfer(t *testing.T) {
|
||||||
@ -45,7 +47,7 @@ func testReconnectDuringTransfer(t *testing.T, restartSender, restartReceiver bo
|
|||||||
|
|
||||||
receiver := startInstance(t, 2)
|
receiver := startInstance(t, 2)
|
||||||
defer func() {
|
defer func() {
|
||||||
// We need a receiver over sender, since we'll update it later to
|
// We need a closure over sender, since we'll update it later to
|
||||||
// point at another process.
|
// point at another process.
|
||||||
checkedStop(t, receiver)
|
checkedStop(t, receiver)
|
||||||
}()
|
}()
|
||||||
@ -72,7 +74,7 @@ func testReconnectDuringTransfer(t *testing.T, restartSender, restartReceiver bo
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if recv.InSyncBytes > 0 && recv.InSyncBytes == recv.GlobalBytes {
|
if recv.InSyncBytes > 0 && recv.InSyncBytes == recv.GlobalBytes && rc.InSync("default", receiver, sender) {
|
||||||
// Receiver is done
|
// Receiver is done
|
||||||
break
|
break
|
||||||
} else if recv.InSyncBytes > prevBytes+recv.GlobalBytes/10 {
|
} else if recv.InSyncBytes > prevBytes+recv.GlobalBytes/10 {
|
||||||
@ -115,6 +117,10 @@ func testReconnectDuringTransfer(t *testing.T, restartSender, restartReceiver bo
|
|||||||
log.Println("Comparing directories...")
|
log.Println("Comparing directories...")
|
||||||
err = compareDirectories("s1", "s2")
|
err = compareDirectories("s1", "s2")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := checkRemoteInSync("default", receiver, sender); err != nil {
|
||||||
|
t.Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ func TestSymlinks(t *testing.T) {
|
|||||||
|
|
||||||
// Use no versioning
|
// Use no versioning
|
||||||
id, _ := protocol.DeviceIDFromString(id2)
|
id, _ := protocol.DeviceIDFromString(id2)
|
||||||
cfg, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
cfg, _, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
||||||
fld := cfg.Folders()["default"]
|
fld := cfg.Folders()["default"]
|
||||||
fld.Versioning = config.VersioningConfiguration{}
|
fld.Versioning = config.VersioningConfiguration{}
|
||||||
cfg.SetFolder(fld)
|
cfg.SetFolder(fld)
|
||||||
@ -44,7 +44,7 @@ func TestSymlinksSimpleVersioning(t *testing.T) {
|
|||||||
|
|
||||||
// Use simple versioning
|
// Use simple versioning
|
||||||
id, _ := protocol.DeviceIDFromString(id2)
|
id, _ := protocol.DeviceIDFromString(id2)
|
||||||
cfg, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
cfg, _, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
||||||
fld := cfg.Folders()["default"]
|
fld := cfg.Folders()["default"]
|
||||||
fld.Versioning = config.VersioningConfiguration{
|
fld.Versioning = config.VersioningConfiguration{
|
||||||
Type: "simple",
|
Type: "simple",
|
||||||
@ -65,7 +65,7 @@ func TestSymlinksStaggeredVersioning(t *testing.T) {
|
|||||||
|
|
||||||
// Use staggered versioning
|
// Use staggered versioning
|
||||||
id, _ := protocol.DeviceIDFromString(id2)
|
id, _ := protocol.DeviceIDFromString(id2)
|
||||||
cfg, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
cfg, _, _ := config.Load("h2/config.xml", id, events.NoopLogger)
|
||||||
fld := cfg.Folders()["default"]
|
fld := cfg.Folders()["default"]
|
||||||
fld.Versioning = config.VersioningConfiguration{
|
fld.Versioning = config.VersioningConfiguration{
|
||||||
Type: "staggered",
|
Type: "staggered",
|
||||||
|
@ -293,6 +293,19 @@ func scSyncAndCompare(p []*rc.Process, expected [][]fileInfo) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := checkRemoteInSync("default", p[0], p[1]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := checkRemoteInSync("default", p[0], p[2]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := checkRemoteInSync(s12Folder, p[0], p[1]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := checkRemoteInSync("s23", p[1], p[2]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
test/util.go
16
test/util.go
@ -562,3 +562,19 @@ func symlinksSupported() bool {
|
|||||||
err = os.Symlink("tmp", filepath.Join(tmp, "link"))
|
err = os.Symlink("tmp", filepath.Join(tmp, "link"))
|
||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// checkRemoteInSync checks if the devices associated twith the given processes
|
||||||
|
// are in sync according to the remote status on both sides.
|
||||||
|
func checkRemoteInSync(folder string, p1, p2 *rc.Process) error {
|
||||||
|
if inSync, err := p1.RemoteInSync(folder, p2.ID()); err != nil {
|
||||||
|
return err
|
||||||
|
} else if !inSync {
|
||||||
|
return fmt.Errorf(`from device %v folder "%v" is not in sync on device %v`, p1.ID(), folder, p2.ID())
|
||||||
|
}
|
||||||
|
if inSync, err := p2.RemoteInSync(folder, p1.ID()); err != nil {
|
||||||
|
return err
|
||||||
|
} else if !inSync {
|
||||||
|
return fmt.Errorf(`from device %v folder "%v" is not in sync on device %v`, p2.ID(), folder, p1.ID())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user