mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
lib/model: Introduce setupModel test utility (#5524)
This commit is contained in:
parent
dc929946fe
commit
d85ef949be
@ -153,36 +153,36 @@ func createTmpWrapper(cfg config.Configuration) *config.Wrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newState(cfg config.Configuration) (*config.Wrapper, *Model) {
|
func newState(cfg config.Configuration) (*config.Wrapper, *Model) {
|
||||||
db := db.OpenMemory()
|
|
||||||
|
|
||||||
wcfg := createTmpWrapper(cfg)
|
wcfg := createTmpWrapper(cfg)
|
||||||
|
|
||||||
m := NewModel(wcfg, myID, "syncthing", "dev", db, nil)
|
m := setupModel(wcfg)
|
||||||
for _, folder := range cfg.Folders {
|
|
||||||
if !folder.Paused {
|
|
||||||
m.AddFolder(folder)
|
|
||||||
m.StartFolder(folder.ID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.ServeBackground()
|
|
||||||
|
|
||||||
for _, dev := range cfg.Devices {
|
for _, dev := range cfg.Devices {
|
||||||
m.AddConnection(&fakeConnection{id: dev.DeviceID}, protocol.HelloResult{})
|
m.AddConnection(&fakeConnection{id: dev.DeviceID}, protocol.HelloResult{})
|
||||||
}
|
}
|
||||||
|
|
||||||
return wcfg, m
|
return wcfg, m
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRequest(t *testing.T) {
|
func setupModel(w *config.Wrapper) *Model {
|
||||||
db := db.OpenMemory()
|
db := db.OpenMemory()
|
||||||
|
m := NewModel(w, myID, "syncthing", "dev", db, nil)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
|
|
||||||
// device1 shares default, but device2 doesn't
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
m.ServeBackground()
|
||||||
|
for id, cfg := range w.Folders() {
|
||||||
|
if !cfg.Paused {
|
||||||
|
m.AddFolder(cfg)
|
||||||
|
m.StartFolder(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m.ScanFolders()
|
||||||
|
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRequest(t *testing.T) {
|
||||||
|
m := setupModel(defaultCfgWrapper)
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
m.ScanFolder("default")
|
|
||||||
|
|
||||||
// Existing, shared file
|
// Existing, shared file
|
||||||
res, err := m.Request(device1, "default", "foo", 6, 0, nil, 0, false)
|
res, err := m.Request(device1, "default", "foo", 6, 0, nil, 0, false)
|
||||||
@ -250,11 +250,7 @@ func BenchmarkIndex_100(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func benchmarkIndex(b *testing.B, nfiles int) {
|
func benchmarkIndex(b *testing.B, nfiles int) {
|
||||||
db := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
files := genFiles(nfiles)
|
files := genFiles(nfiles)
|
||||||
@ -280,11 +276,7 @@ func BenchmarkIndexUpdate_10000_1(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func benchmarkIndexUpdate(b *testing.B, nfiles, nufiles int) {
|
func benchmarkIndexUpdate(b *testing.B, nfiles, nufiles int) {
|
||||||
db := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
files := genFiles(nfiles)
|
files := genFiles(nfiles)
|
||||||
@ -486,12 +478,8 @@ func (f *fakeConnection) sendIndexUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkRequestOut(b *testing.B) {
|
func BenchmarkRequestOut(b *testing.B) {
|
||||||
db := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
m.ScanFolder("default")
|
|
||||||
|
|
||||||
const n = 1000
|
const n = 1000
|
||||||
files := genFiles(n)
|
files := genFiles(n)
|
||||||
@ -518,12 +506,7 @@ func BenchmarkRequestOut(b *testing.B) {
|
|||||||
func BenchmarkRequestInSingleFile(b *testing.B) {
|
func BenchmarkRequestInSingleFile(b *testing.B) {
|
||||||
testOs := &fatalOs{b}
|
testOs := &fatalOs{b}
|
||||||
|
|
||||||
db := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
|
||||||
m.ScanFolder("default")
|
|
||||||
|
|
||||||
buf := make([]byte, 128<<10)
|
buf := make([]byte, 128<<10)
|
||||||
rand.Read(buf)
|
rand.Read(buf)
|
||||||
@ -1731,16 +1714,9 @@ func TestIgnores(t *testing.T) {
|
|||||||
testOs.MkdirAll(filepath.Join("testdata", config.DefaultMarkerName), 0644)
|
testOs.MkdirAll(filepath.Join("testdata", config.DefaultMarkerName), 0644)
|
||||||
ioutil.WriteFile("testdata/.stignore", []byte(".*\nquux\n"), 0644)
|
ioutil.WriteFile("testdata/.stignore", []byte(".*\nquux\n"), 0644)
|
||||||
|
|
||||||
db := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
// m.cfg.SetFolder is not usable as it is non-blocking, and there is no
|
|
||||||
// way to know when the folder is actually added.
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
|
|
||||||
// Reach in and update the ignore matcher to one that always does
|
// Reach in and update the ignore matcher to one that always does
|
||||||
// reloads when asked to, instead of checking file mtimes. This is
|
// reloads when asked to, instead of checking file mtimes. This is
|
||||||
// because we will be changing the files on disk often enough that the
|
// because we will be changing the files on disk often enough that the
|
||||||
@ -2426,16 +2402,7 @@ func TestIssue3028(t *testing.T) {
|
|||||||
|
|
||||||
// Create a model and default folder
|
// Create a model and default folder
|
||||||
|
|
||||||
db := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
defCfg := defaultFolderConfig.Copy()
|
|
||||||
defCfg.RescanIntervalS = 86400
|
|
||||||
m.AddFolder(defCfg)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
|
|
||||||
// Make sure the initial scan has finished (ScanFolders is blocking)
|
|
||||||
m.ScanFolders()
|
|
||||||
|
|
||||||
// Get a count of how many files are there now
|
// Get a count of how many files are there now
|
||||||
|
|
||||||
@ -2580,12 +2547,7 @@ func TestIssue2782(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer testOs.RemoveAll(testDir)
|
defer testOs.RemoveAll(testDir)
|
||||||
|
|
||||||
db := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(testFolderConfig("~/" + testName + "/synclink/"))
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
|
||||||
|
|
||||||
if err := m.ScanFolder("default"); err != nil {
|
if err := m.ScanFolder("default"); err != nil {
|
||||||
t.Error("scan error:", err)
|
t.Error("scan error:", err)
|
||||||
@ -2627,8 +2589,6 @@ func TestIndexesForUnknownDevicesDropped(t *testing.T) {
|
|||||||
func TestSharedWithClearedOnDisconnect(t *testing.T) {
|
func TestSharedWithClearedOnDisconnect(t *testing.T) {
|
||||||
testOs := &fatalOs{t}
|
testOs := &fatalOs{t}
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
|
||||||
|
|
||||||
wcfg := createTmpWrapper(defaultCfg)
|
wcfg := createTmpWrapper(defaultCfg)
|
||||||
wcfg.SetDevice(config.NewDeviceConfiguration(device2, "device2"))
|
wcfg.SetDevice(config.NewDeviceConfiguration(device2, "device2"))
|
||||||
fcfg := wcfg.FolderList()[0]
|
fcfg := wcfg.FolderList()[0]
|
||||||
@ -2636,10 +2596,8 @@ func TestSharedWithClearedOnDisconnect(t *testing.T) {
|
|||||||
wcfg.SetFolder(fcfg)
|
wcfg.SetFolder(fcfg)
|
||||||
defer testOs.Remove(wcfg.ConfigPath())
|
defer testOs.Remove(wcfg.ConfigPath())
|
||||||
|
|
||||||
m := NewModel(wcfg, myID, "syncthing", "dev", dbi, nil)
|
m := setupModel(wcfg)
|
||||||
m.AddFolder(fcfg)
|
defer m.Stop()
|
||||||
m.StartFolder(fcfg.ID)
|
|
||||||
m.ServeBackground()
|
|
||||||
|
|
||||||
conn1 := &fakeConnection{id: device1}
|
conn1 := &fakeConnection{id: device1}
|
||||||
m.AddConnection(conn1, protocol.HelloResult{})
|
m.AddConnection(conn1, protocol.HelloResult{})
|
||||||
@ -2746,11 +2704,7 @@ func TestIssue3496(t *testing.T) {
|
|||||||
// percentages. Lets make sure that doesn't happen. Also do some general
|
// percentages. Lets make sure that doesn't happen. Also do some general
|
||||||
// checks on the completion calculation stuff.
|
// checks on the completion calculation stuff.
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", dbi, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
m.ScanFolder("default")
|
m.ScanFolder("default")
|
||||||
@ -2819,11 +2773,7 @@ func TestIssue3496(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIssue3804(t *testing.T) {
|
func TestIssue3804(t *testing.T) {
|
||||||
dbi := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", dbi, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
// Subdirs ending in slash should be accepted
|
// Subdirs ending in slash should be accepted
|
||||||
@ -2834,11 +2784,7 @@ func TestIssue3804(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIssue3829(t *testing.T) {
|
func TestIssue3829(t *testing.T) {
|
||||||
dbi := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", dbi, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
// Empty subdirs should be accepted
|
// Empty subdirs should be accepted
|
||||||
@ -2853,8 +2799,6 @@ func TestNoRequestsFromPausedDevices(t *testing.T) {
|
|||||||
|
|
||||||
testOs := &fatalOs{t}
|
testOs := &fatalOs{t}
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
|
||||||
|
|
||||||
wcfg := createTmpWrapper(defaultCfg)
|
wcfg := createTmpWrapper(defaultCfg)
|
||||||
wcfg.SetDevice(config.NewDeviceConfiguration(device2, "device2"))
|
wcfg.SetDevice(config.NewDeviceConfiguration(device2, "device2"))
|
||||||
fcfg := wcfg.FolderList()[0]
|
fcfg := wcfg.FolderList()[0]
|
||||||
@ -2862,10 +2806,8 @@ func TestNoRequestsFromPausedDevices(t *testing.T) {
|
|||||||
wcfg.SetFolder(fcfg)
|
wcfg.SetFolder(fcfg)
|
||||||
defer testOs.Remove(wcfg.ConfigPath())
|
defer testOs.Remove(wcfg.ConfigPath())
|
||||||
|
|
||||||
m := NewModel(wcfg, myID, "syncthing", "dev", dbi, nil)
|
m := setupModel(wcfg)
|
||||||
m.AddFolder(fcfg)
|
defer m.Stop()
|
||||||
m.StartFolder(fcfg.ID)
|
|
||||||
m.ServeBackground()
|
|
||||||
|
|
||||||
file := testDataExpected["foo"]
|
file := testDataExpected["foo"]
|
||||||
files := m.folderFiles["default"]
|
files := m.folderFiles["default"]
|
||||||
@ -2959,13 +2901,7 @@ func TestIssue2571(t *testing.T) {
|
|||||||
fd.Close()
|
fd.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", dbi, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
|
||||||
m.ScanFolder("default")
|
|
||||||
|
|
||||||
if err = testFs.RemoveAll("toLink"); err != nil {
|
if err = testFs.RemoveAll("toLink"); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -3011,13 +2947,7 @@ func TestIssue4573(t *testing.T) {
|
|||||||
}
|
}
|
||||||
fd.Close()
|
fd.Close()
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", dbi, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
|
||||||
m.ScanFolder("default")
|
|
||||||
|
|
||||||
err = defaultFs.Chmod("inaccessible", 0000)
|
err = defaultFs.Chmod("inaccessible", 0000)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -3080,13 +3010,7 @@ func TestInternalScan(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", dbi, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
|
||||||
m.ScanFolder("default")
|
|
||||||
|
|
||||||
for _, dir := range baseDirs {
|
for _, dir := range baseDirs {
|
||||||
if err = testFs.RemoveAll(dir); err != nil {
|
if err = testFs.RemoveAll(dir); err != nil {
|
||||||
@ -3191,13 +3115,8 @@ func TestRemoveDirWithContent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
fd.Close()
|
fd.Close()
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", dbi, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
m.ScanFolder("default")
|
|
||||||
|
|
||||||
dir, ok := m.CurrentFolderFile("default", "dirwith")
|
dir, ok := m.CurrentFolderFile("default", "dirwith")
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -3256,13 +3175,8 @@ func TestIssue4475(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", dbi, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
m.ScanFolder("default")
|
|
||||||
|
|
||||||
// Scenario: Dir is deleted locally and before syncing/index exchange
|
// Scenario: Dir is deleted locally and before syncing/index exchange
|
||||||
// happens, a file is create in that dir on the remote.
|
// happens, a file is create in that dir on the remote.
|
||||||
@ -3331,8 +3245,6 @@ func TestVersionRestore(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer testOs.RemoveAll(dir)
|
defer testOs.RemoveAll(dir)
|
||||||
|
|
||||||
dbi := db.OpenMemory()
|
|
||||||
|
|
||||||
fcfg := config.NewFolderConfiguration(myID, "default", "default", fs.FilesystemTypeBasic, dir)
|
fcfg := config.NewFolderConfiguration(myID, "default", "default", fs.FilesystemTypeBasic, dir)
|
||||||
fcfg.Versioning.Type = "simple"
|
fcfg.Versioning.Type = "simple"
|
||||||
fcfg.FSWatcherEnabled = false
|
fcfg.FSWatcherEnabled = false
|
||||||
@ -3344,11 +3256,7 @@ func TestVersionRestore(t *testing.T) {
|
|||||||
cfg := createTmpWrapper(rawConfig)
|
cfg := createTmpWrapper(rawConfig)
|
||||||
defer testOs.Remove(cfg.ConfigPath())
|
defer testOs.Remove(cfg.ConfigPath())
|
||||||
|
|
||||||
m := NewModel(cfg, myID, "syncthing", "dev", dbi, nil)
|
m := setupModel(cfg)
|
||||||
m.AddFolder(fcfg)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
|
||||||
m.ScanFolder("default")
|
m.ScanFolder("default")
|
||||||
|
|
||||||
sentinel, err := time.ParseInLocation(versioner.TimeFormat, "20200101-010101", locationLocal)
|
sentinel, err := time.ParseInLocation(versioner.TimeFormat, "20200101-010101", locationLocal)
|
||||||
@ -3536,15 +3444,10 @@ func TestPausedFolders(t *testing.T) {
|
|||||||
testOs := &fatalOs{t}
|
testOs := &fatalOs{t}
|
||||||
|
|
||||||
// Create a separate wrapper not to pollute other tests.
|
// Create a separate wrapper not to pollute other tests.
|
||||||
cfg := defaultCfgWrapper.RawCopy()
|
wrapper := createTmpWrapper(defaultCfgWrapper.RawCopy())
|
||||||
wrapper := createTmpWrapper(cfg)
|
|
||||||
defer testOs.Remove(wrapper.ConfigPath())
|
defer testOs.Remove(wrapper.ConfigPath())
|
||||||
|
|
||||||
db := db.OpenMemory()
|
m := setupModel(wrapper)
|
||||||
m := NewModel(wrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
if err := m.ScanFolder("default"); err != nil {
|
if err := m.ScanFolder("default"); err != nil {
|
||||||
@ -3649,12 +3552,7 @@ func TestIssue4903(t *testing.T) {
|
|||||||
func TestIssue5002(t *testing.T) {
|
func TestIssue5002(t *testing.T) {
|
||||||
// recheckFile should not panic when given an index equal to the number of blocks
|
// recheckFile should not panic when given an index equal to the number of blocks
|
||||||
|
|
||||||
db := db.OpenMemory()
|
m := setupModel(defaultCfgWrapper)
|
||||||
m := NewModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(defaultFolderConfig)
|
|
||||||
m.StartFolder("default")
|
|
||||||
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
if err := m.ScanFolder("default"); err != nil {
|
if err := m.ScanFolder("default"); err != nil {
|
||||||
@ -3721,12 +3619,7 @@ func TestFolderRestartZombies(t *testing.T) {
|
|||||||
folderCfg.FilesystemType = fs.FilesystemTypeFake
|
folderCfg.FilesystemType = fs.FilesystemTypeFake
|
||||||
wrapper.SetFolder(folderCfg)
|
wrapper.SetFolder(folderCfg)
|
||||||
|
|
||||||
db := db.OpenMemory()
|
m := setupModel(wrapper)
|
||||||
m := NewModel(wrapper, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(folderCfg)
|
|
||||||
m.StartFolder("default")
|
|
||||||
|
|
||||||
m.ServeBackground()
|
|
||||||
defer m.Stop()
|
defer m.Stop()
|
||||||
|
|
||||||
// Make sure the folder is up and running, because we want to count it.
|
// Make sure the folder is up and running, because we want to count it.
|
||||||
|
@ -740,11 +740,7 @@ func setupModelWithConnection() (*Model, *fakeConnection, string, *config.Wrappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setupModelWithConnectionFromWrapper(w *config.Wrapper) (*Model, *fakeConnection) {
|
func setupModelWithConnectionFromWrapper(w *config.Wrapper) (*Model, *fakeConnection) {
|
||||||
db := db.OpenMemory()
|
m := setupModel(w)
|
||||||
m := NewModel(w, myID, "syncthing", "dev", db, nil)
|
|
||||||
m.AddFolder(w.FolderList()[0])
|
|
||||||
m.ServeBackground()
|
|
||||||
m.StartFolder("default")
|
|
||||||
|
|
||||||
fc := addFakeConn(m, device1)
|
fc := addFakeConn(m, device1)
|
||||||
fc.folder = "default"
|
fc.folder = "default"
|
||||||
|
Loading…
Reference in New Issue
Block a user