(t *testing.T)
| 2136 | } |
| 2137 | |
| 2138 | func TestIssue4357(t *testing.T) { |
| 2139 | cfg := defaultCfgWrapper.RawCopy() |
| 2140 | // Create a separate wrapper not to pollute other tests. |
| 2141 | wrapper, cancel := newConfigWrapper(config.Configuration{Version: config.CurrentVersion}) |
| 2142 | defer cancel() |
| 2143 | m := newModel(t, wrapper, myID, nil) |
| 2144 | m.ServeBackground() |
| 2145 | defer cleanupModel(m) |
| 2146 | |
| 2147 | // Force the model to wire itself and add the folders |
| 2148 | replace(t, wrapper, cfg) |
| 2149 | |
| 2150 | if _, ok := m.folderCfgs["default"]; !ok { |
| 2151 | t.Error("Folder should be running") |
| 2152 | } |
| 2153 | |
| 2154 | newCfg := wrapper.RawCopy() |
| 2155 | newCfg.Folders[0].Paused = true |
| 2156 | |
| 2157 | replace(t, wrapper, newCfg) |
| 2158 | |
| 2159 | if _, ok := m.folderCfgs["default"]; ok { |
| 2160 | t.Error("Folder should not be running") |
| 2161 | } |
| 2162 | |
| 2163 | if _, ok := m.cfg.Folder("default"); !ok { |
| 2164 | t.Error("should still have folder in config") |
| 2165 | } |
| 2166 | |
| 2167 | replace(t, wrapper, config.Configuration{Version: config.CurrentVersion}) |
| 2168 | |
| 2169 | if _, ok := m.cfg.Folder("default"); ok { |
| 2170 | t.Error("should not have folder in config") |
| 2171 | } |
| 2172 | |
| 2173 | // Add the folder back, should be running |
| 2174 | replace(t, wrapper, cfg) |
| 2175 | |
| 2176 | if _, ok := m.folderCfgs["default"]; !ok { |
| 2177 | t.Error("Folder should be running") |
| 2178 | } |
| 2179 | if _, ok := m.cfg.Folder("default"); !ok { |
| 2180 | t.Error("should still have folder in config") |
| 2181 | } |
| 2182 | |
| 2183 | // Should not panic when removing a running folder. |
| 2184 | replace(t, wrapper, config.Configuration{Version: config.CurrentVersion}) |
| 2185 | |
| 2186 | if _, ok := m.folderCfgs["default"]; ok { |
| 2187 | t.Error("Folder should not be running") |
| 2188 | } |
| 2189 | if _, ok := m.cfg.Folder("default"); ok { |
| 2190 | t.Error("should not have folder in config") |
| 2191 | } |
| 2192 | } |
| 2193 | |
| 2194 | func TestIndexesForUnknownDevicesDropped(t *testing.T) { |
| 2195 | m := newModel(t, defaultCfgWrapper, myID, nil) |
nothing calls this directly
no test coverage detected