MCPcopy
hub / github.com/syncthing/syncthing / TestCCFolderNotRunning

Function TestCCFolderNotRunning

lib/model/model_test.go:3984–4010  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3982}
3983
3984func TestCCFolderNotRunning(t *testing.T) {
3985 // Create the folder, but don't start it.
3986 w, fcfg := newDefaultCfgWrapper(t)
3987 tfs := fcfg.Filesystem()
3988 m := newModel(t, w, myID, nil)
3989 defer cleanupModelAndRemoveDir(m, tfs.URI())
3990
3991 // A connection can happen before all the folders are started.
3992 cc, _ := m.generateClusterConfig(device1)
3993 if l := len(cc.Folders); l != 1 {
3994 t.Fatalf("Expected 1 folder in CC, got %v", l)
3995 }
3996 folder := cc.Folders[0]
3997 if id := folder.ID; id != fcfg.ID {
3998 t.Fatalf("Expected folder %v, got %v", fcfg.ID, id)
3999 }
4000 if l := len(folder.Devices); l != 2 {
4001 t.Fatalf("Expected 2 devices in CC, got %v", l)
4002 }
4003 local := folder.Devices[1]
4004 if local.ID != myID {
4005 local = folder.Devices[0]
4006 }
4007 if folder.StopReason != protocol.FolderStopReasonPaused && local.IndexID == 0 {
4008 t.Errorf("Folder isn't paused, but index-id is zero")
4009 }
4010}
4011
4012func TestPendingFolder(t *testing.T) {
4013 w, _ := newDefaultCfgWrapper(t)

Callers

nothing calls this directly

Calls 6

newDefaultCfgWrapperFunction · 0.85
newModelFunction · 0.85
cleanupModelAndRemoveDirFunction · 0.85
FilesystemMethod · 0.80
generateClusterConfigMethod · 0.80
URIMethod · 0.65

Tested by

no test coverage detected