(t testing.TB, cfg config.Wrapper, id protocol.DeviceID, protectedFiles []string)
| 153 | } |
| 154 | |
| 155 | func 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 | |
| 176 | func (m *testModel) ServeBackground() { |
| 177 | ctx, cancel := context.WithCancel(context.Background()) |
no test coverage detected