MCPcopy
hub / github.com/syncthing/syncthing / TestIssue4573

Function TestIssue4573

lib/model/model_test.go:2335–2360  ·  view source on GitHub ↗

TestIssue4573 tests that contents of an unavailable dir aren't marked deleted

(t *testing.T)

Source from the content-addressed store, hash-verified

2333
2334// TestIssue4573 tests that contents of an unavailable dir aren't marked deleted
2335func TestIssue4573(t *testing.T) {
2336 w, fcfg := newDefaultCfgWrapper(t)
2337 testFs := fcfg.Filesystem()
2338 defer os.RemoveAll(testFs.URI())
2339
2340 must(t, testFs.MkdirAll("inaccessible", 0o755))
2341 defer testFs.Chmod("inaccessible", 0o777)
2342
2343 file := filepath.Join("inaccessible", "a")
2344 fd, err := testFs.Create(file)
2345 must(t, err)
2346 fd.Close()
2347
2348 m := setupModel(t, w)
2349 defer cleanupModel(m)
2350
2351 must(t, testFs.Chmod("inaccessible", 0o000))
2352
2353 m.ScanFolder("default")
2354
2355 if file, ok := m.testCurrentFolderFile("default", file); !ok {
2356 t.Fatalf("File missing in db")
2357 } else if file.Deleted {
2358 t.Errorf("Inaccessible file has been marked as deleted.")
2359 }
2360}
2361
2362// TestInternalScan checks whether various fs operations are correctly represented
2363// in the db after scanning.

Callers

nothing calls this directly

Calls 13

newDefaultCfgWrapperFunction · 0.85
mustFunction · 0.85
setupModelFunction · 0.85
cleanupModelFunction · 0.85
FilesystemMethod · 0.80
testCurrentFolderFileMethod · 0.80
RemoveAllMethod · 0.65
URIMethod · 0.65
MkdirAllMethod · 0.65
ChmodMethod · 0.65
CreateMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected