TestIssue4573 tests that contents of an unavailable dir aren't marked deleted
(t *testing.T)
| 2333 | |
| 2334 | // TestIssue4573 tests that contents of an unavailable dir aren't marked deleted |
| 2335 | func 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. |
nothing calls this directly
no test coverage detected