MCPcopy
hub / github.com/syncthing/syncthing / TestIssue4841

Function TestIssue4841

lib/scanner/walk_test.go:790–827  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

788}
789
790func 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
830func TestNotExistingError(t *testing.T) {

Callers

nothing calls this directly

Calls 9

CreateMethod · 0.95
StringFunction · 0.92
testConfigFunction · 0.85
WalkFunction · 0.85
fileListTypeAlias · 0.85
ShortMethod · 0.80
CloseMethod · 0.65
UpdateMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected