(t *testing.T)
| 3492 | } |
| 3493 | |
| 3494 | func TestScanRenameCaseOnly(t *testing.T) { |
| 3495 | wcfg, fcfg := newDefaultCfgWrapper(t) |
| 3496 | m := setupModel(t, wcfg) |
| 3497 | defer cleanupModel(m) |
| 3498 | |
| 3499 | ffs := fcfg.Filesystem() |
| 3500 | name := "foo" |
| 3501 | writeFile(t, ffs, name, []byte("contents")) |
| 3502 | |
| 3503 | m.ScanFolders() |
| 3504 | |
| 3505 | found := false |
| 3506 | for i, err := range itererr.Zip(m.LocalFiles(fcfg.ID, protocol.LocalDeviceID)) { |
| 3507 | if err != nil { |
| 3508 | t.Fatal(err) |
| 3509 | } |
| 3510 | if found { |
| 3511 | t.Fatal("got more than one file") |
| 3512 | } |
| 3513 | if i.FileName() != name { |
| 3514 | t.Fatalf("got file %v, expected %v", i.FileName(), name) |
| 3515 | } |
| 3516 | found = true |
| 3517 | } |
| 3518 | |
| 3519 | upper := strings.ToUpper(name) |
| 3520 | must(t, ffs.Rename(name, upper)) |
| 3521 | m.ScanFolders() |
| 3522 | |
| 3523 | found = false |
| 3524 | for i, err := range itererr.Zip(m.LocalFiles(fcfg.ID, protocol.LocalDeviceID)) { |
| 3525 | if err != nil { |
| 3526 | t.Fatal(err) |
| 3527 | } |
| 3528 | if i.FileName() == name { |
| 3529 | if i.IsDeleted() { |
| 3530 | continue |
| 3531 | } |
| 3532 | t.Fatal("renamed file not deleted") |
| 3533 | } |
| 3534 | if i.FileName() != upper { |
| 3535 | t.Fatalf("got file %v, expected %v", i.FileName(), upper) |
| 3536 | } |
| 3537 | if found { |
| 3538 | t.Fatal("got more than the expected files") |
| 3539 | } |
| 3540 | found = true |
| 3541 | } |
| 3542 | } |
| 3543 | |
| 3544 | func TestClusterConfigOnFolderAdd(t *testing.T) { |
| 3545 | testConfigChangeTriggersClusterConfigs(t, false, true, nil, func(wrapper config.Wrapper) { |
nothing calls this directly
no test coverage detected