(t *testing.T)
| 3612 | } |
| 3613 | |
| 3614 | func TestScanDeletedROChangedOnSR(t *testing.T) { |
| 3615 | m, conn, fcfg := setupModelWithConnection(t) |
| 3616 | ffs := fcfg.Filesystem() |
| 3617 | defer cleanupModelAndRemoveDir(m, ffs.URI()) |
| 3618 | fcfg.Type = config.FolderTypeReceiveOnly |
| 3619 | setFolder(t, m.cfg, fcfg) |
| 3620 | |
| 3621 | name := "foo" |
| 3622 | |
| 3623 | writeFile(t, ffs, name, []byte(name)) |
| 3624 | m.ScanFolders() |
| 3625 | |
| 3626 | file, ok := m.testCurrentFolderFile(fcfg.ID, name) |
| 3627 | if !ok { |
| 3628 | t.Fatal("file missing in db") |
| 3629 | } |
| 3630 | // A remote must have the file, otherwise the deletion below is |
| 3631 | // automatically resolved as not a ro-changed item. |
| 3632 | file.LocalFlags = 0 // clear as we're skipping the code path where it would otherwise be cleared naturally |
| 3633 | must(t, m.IndexUpdate(conn, &protocol.IndexUpdate{Folder: fcfg.ID, Files: []protocol.FileInfo{file}})) |
| 3634 | |
| 3635 | must(t, ffs.Remove(name)) |
| 3636 | m.ScanFolders() |
| 3637 | |
| 3638 | if mustV(m.ReceiveOnlySize(fcfg.ID)).Deleted != 1 { |
| 3639 | t.Fatal("expected one receive only changed deleted item") |
| 3640 | } |
| 3641 | |
| 3642 | fcfg.Type = config.FolderTypeSendReceive |
| 3643 | setFolder(t, m.cfg, fcfg) |
| 3644 | m.ScanFolders() |
| 3645 | |
| 3646 | if mustV(m.ReceiveOnlySize(fcfg.ID)).Deleted != 0 { |
| 3647 | t.Fatal("expected no receive only changed deleted item") |
| 3648 | } |
| 3649 | if mustV(m.LocalSize(fcfg.ID, protocol.LocalDeviceID)).Deleted != 1 { |
| 3650 | t.Fatal("expected one local deleted item") |
| 3651 | } |
| 3652 | } |
| 3653 | |
| 3654 | func testConfigChangeTriggersClusterConfigs(t *testing.T, expectFirst, expectSecond bool, pre func(config.Wrapper), fn func(config.Wrapper)) { |
| 3655 | t.Helper() |
nothing calls this directly
no test coverage detected