MCPcopy
hub / github.com/syncthing/syncthing / newModel

Function newModel

lib/model/testutils_test.go:155–174  ·  view source on GitHub ↗
(t testing.TB, cfg config.Wrapper, id protocol.DeviceID, protectedFiles []string)

Source from the content-addressed store, hash-verified

153}
154
155func newModel(t testing.TB, cfg config.Wrapper, id protocol.DeviceID, protectedFiles []string) *testModel {
156 t.Helper()
157 evLogger := events.NewLogger()
158 mdb, err := sqlite.Open(t.TempDir())
159 if err != nil {
160 t.Fatal(err)
161 }
162 t.Cleanup(func() {
163 mdb.Close()
164 })
165 m := NewModel(cfg, id, mdb, protectedFiles, evLogger, protocol.NewKeyGenerator()).(*model)
166 ctx, cancel := context.WithCancel(t.Context())
167 go evLogger.Serve(ctx)
168 return &testModel{
169 model: m,
170 evCancel: cancel,
171 stopped: make(chan struct{}),
172 t: t,
173 }
174}
175
176func (m *testModel) ServeBackground() {
177 ctx, cancel := context.WithCancel(context.Background())

Callers 14

setupModelFunction · 0.85
setupROFolderFunction · 0.85
TestDeviceRenameFunction · 0.85
TestClusterConfigFunction · 0.85
TestROScanRecoveryFunction · 0.85
TestRWScanRecoveryFunction · 0.85
TestIssue4357Function · 0.85
TestCustomMarkerNameFunction · 0.85
TestIssue4094Function · 0.85
TestIssue6961Function · 0.85

Calls 8

NewLoggerFunction · 0.92
OpenFunction · 0.92
NewKeyGeneratorFunction · 0.92
NewModelFunction · 0.85
HelperMethod · 0.80
FatalMethod · 0.80
CloseMethod · 0.65
ServeMethod · 0.45

Tested by

no test coverage detected