MCPcopy
hub / github.com/syncthing/syncthing / TestRWScanRecovery

Function TestRWScanRecovery

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

Source from the content-addressed store, hash-verified

1722}
1723
1724func TestRWScanRecovery(t *testing.T) {
1725 fcfg := config.FolderConfiguration{
1726 FilesystemType: config.FilesystemTypeFake,
1727 ID: "default",
1728 Path: srand.String(32),
1729 Type: config.FolderTypeSendReceive,
1730 RescanIntervalS: 1,
1731 MarkerName: config.DefaultMarkerName,
1732 }
1733 cfg, cancel := newConfigWrapper(config.Configuration{
1734 Version: config.CurrentVersion,
1735 Folders: []config.FolderConfiguration{fcfg},
1736 Devices: []config.DeviceConfiguration{
1737 {
1738 DeviceID: device1,
1739 },
1740 },
1741 })
1742 defer cancel()
1743 m := newModel(t, cfg, myID, nil)
1744
1745 m.sdb.Update("default", protocol.LocalDeviceID, []protocol.FileInfo{
1746 {Name: "dummyfile", Version: protocol.Vector{Counters: []protocol.Counter{{ID: 42, Value: 1}}}},
1747 })
1748
1749 ffs := fcfg.Filesystem()
1750
1751 // Generate error
1752 if err := ffs.Remove(config.DefaultMarkerName); err != nil {
1753 t.Fatal(err)
1754 }
1755
1756 sub := m.evLogger.Subscribe(events.StateChanged)
1757 defer sub.Unsubscribe()
1758 m.ServeBackground()
1759 defer cleanupModel(m)
1760
1761 waitForState(t, sub, "default", config.ErrMarkerMissing.Error())
1762
1763 fd, err := ffs.Create(config.DefaultMarkerName)
1764 if err != nil {
1765 t.Error(err)
1766 }
1767 fd.Close()
1768
1769 waitForState(t, sub, "default", "")
1770}
1771
1772func TestGlobalDirectoryTree(t *testing.T) {
1773 m, conn, fcfg := setupModelWithConnection(t)

Callers

nothing calls this directly

Calls 15

FilesystemMethod · 0.95
newConfigWrapperFunction · 0.85
newModelFunction · 0.85
cleanupModelFunction · 0.85
waitForStateFunction · 0.85
FatalMethod · 0.80
ServeBackgroundMethod · 0.80
StringMethod · 0.65
UpdateMethod · 0.65
RemoveMethod · 0.65
SubscribeMethod · 0.65
UnsubscribeMethod · 0.65

Tested by

no test coverage detected