| 788 | } |
| 789 | |
| 790 | func TestIssue4841(t *testing.T) { |
| 791 | fs := fs.NewFilesystem(fs.FilesystemTypeFake, rand.String(16)) |
| 792 | |
| 793 | fd, err := fs.Create("foo") |
| 794 | if err != nil { |
| 795 | panic(err) |
| 796 | } |
| 797 | fd.Close() |
| 798 | |
| 799 | cfg, cancel := testConfig() |
| 800 | defer cancel() |
| 801 | cfg.Filesystem = fs |
| 802 | cfg.AutoNormalize = true |
| 803 | cfg.CurrentFiler = fakeCurrentFiler{"foo": { |
| 804 | Name: "foo", |
| 805 | Type: protocol.FileInfoTypeFile, |
| 806 | LocalFlags: protocol.FlagLocalIgnored, |
| 807 | Version: protocol.Vector{}.Update(1), |
| 808 | }} |
| 809 | cfg.ShortID = protocol.LocalDeviceID.Short() |
| 810 | fchan := Walk(context.TODO(), cfg) |
| 811 | |
| 812 | var files []protocol.FileInfo |
| 813 | for f := range fchan { |
| 814 | if f.Err != nil { |
| 815 | t.Errorf("Error while scanning %v: %v", f.Err, f.Path) |
| 816 | } |
| 817 | files = append(files, f.File) |
| 818 | } |
| 819 | slices.SortFunc(fileList(files), compareByName) |
| 820 | |
| 821 | if len(files) != 1 { |
| 822 | t.Fatalf("Expected 1 file, got %d: %v", len(files), files) |
| 823 | } |
| 824 | if expected := (protocol.Vector{}.Update(protocol.LocalDeviceID.Short())); !files[0].Version.Equal(expected) { |
| 825 | t.Fatalf("Expected Version == %v, got %v", expected, files[0].Version) |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | // TestNotExistingError reproduces https://github.com/syncthing/syncthing/issues/5385 |
| 830 | func TestNotExistingError(t *testing.T) { |