diff --git a/test/cli_test.go b/test/cli_test.go index c9e2b30ad..2fe31243f 100644 --- a/test/cli_test.go +++ b/test/cli_test.go @@ -11,10 +11,9 @@ package integration import ( "os" "os/exec" + "path/filepath" "testing" "time" - - "github.com/syncthing/syncthing/lib/osutil" ) func TestCLIReset(t *testing.T) { @@ -50,7 +49,7 @@ func TestCLIReset(t *testing.T) { // Clean up - dirs, err = osutil.Glob("*.syncthing-reset-*") + dirs, err = filepath.Glob("*.syncthing-reset-*") if err != nil { t.Fatal(err) } diff --git a/test/conflict_test.go b/test/conflict_test.go index 18f9e61ea..8cd61a5c9 100644 --- a/test/conflict_test.go +++ b/test/conflict_test.go @@ -13,10 +13,10 @@ import ( "io/ioutil" "log" "os" + "path/filepath" "testing" "time" - "github.com/syncthing/syncthing/lib/osutil" "github.com/syncthing/syncthing/lib/rc" ) @@ -127,7 +127,7 @@ func TestConflictsDefault(t *testing.T) { // The conflict is expected on the s2 side due to how we calculate which // file is the winner (based on device ID) - files, err := osutil.Glob("s2/*sync-conflict*") + files, err := filepath.Glob("s2/*sync-conflict*") if err != nil { t.Fatal(err) } @@ -177,7 +177,7 @@ func TestConflictsDefault(t *testing.T) { // As such, we get the edited content synced back to s1 where it was // removed. - files, err = osutil.Glob("s2/*sync-conflict*") + files, err = filepath.Glob("s2/*sync-conflict*") if err != nil { t.Fatal(err) } @@ -253,7 +253,7 @@ func TestConflictsInitialMerge(t *testing.T) { // s1 should have three-four files (there's a conflict from s2 which may or may not have synced yet) - files, err := osutil.Glob("s1/file*") + files, err := filepath.Glob("s1/file*") if err != nil { t.Fatal(err) } @@ -263,7 +263,7 @@ func TestConflictsInitialMerge(t *testing.T) { // s2 should have four files (there's a conflict) - files, err = osutil.Glob("s2/file*") + files, err = filepath.Glob("s2/file*") if err != nil { t.Fatal(err) } @@ -273,7 +273,7 @@ func TestConflictsInitialMerge(t *testing.T) { // file1 is in conflict, so there's two versions of that one - files, err = osutil.Glob("s2/file1*") + files, err = filepath.Glob("s2/file1*") if err != nil { t.Fatal(err) } @@ -328,7 +328,7 @@ func TestConflictsIndexReset(t *testing.T) { // s1 should have three files - files, err := osutil.Glob("s1/file*") + files, err := filepath.Glob("s1/file*") if err != nil { t.Fatal(err) } @@ -338,7 +338,7 @@ func TestConflictsIndexReset(t *testing.T) { // s2 should have three - files, err = osutil.Glob("s2/file*") + files, err = filepath.Glob("s2/file*") if err != nil { t.Fatal(err) } @@ -402,7 +402,7 @@ func TestConflictsIndexReset(t *testing.T) { // s2 should have five files (three plus two conflicts) - files, err = osutil.Glob("s2/file*") + files, err = filepath.Glob("s2/file*") if err != nil { t.Fatal(err) } @@ -412,7 +412,7 @@ func TestConflictsIndexReset(t *testing.T) { // file1 is in conflict, so there's two versions of that one - files, err = osutil.Glob("s2/file1*") + files, err = filepath.Glob("s2/file1*") if err != nil { t.Fatal(err) } @@ -422,7 +422,7 @@ func TestConflictsIndexReset(t *testing.T) { // file2 is in conflict, so there's two versions of that one - files, err = osutil.Glob("s2/file2*") + files, err = filepath.Glob("s2/file2*") if err != nil { t.Fatal(err) } diff --git a/test/manypeers_test.go b/test/manypeers_test.go index 3e42edc3a..11bb32d37 100644 --- a/test/manypeers_test.go +++ b/test/manypeers_test.go @@ -12,10 +12,10 @@ import ( "bytes" "encoding/json" "log" + "os" "testing" "github.com/syncthing/syncthing/lib/config" - "github.com/syncthing/syncthing/lib/osutil" "github.com/syncthing/syncthing/lib/protocol" "github.com/syncthing/syncthing/lib/rc" ) @@ -54,8 +54,8 @@ func TestManyPeers(t *testing.T) { cfg.Folders[0].Devices = append(cfg.Folders[0].Devices, config.FolderDeviceConfiguration{DeviceID: id}) } - osutil.Rename("h2/config.xml", "h2/config.xml.orig") - defer osutil.Rename("h2/config.xml.orig", "h2/config.xml") + os.Rename("h2/config.xml", "h2/config.xml.orig") + defer os.Rename("h2/config.xml.orig", "h2/config.xml") var buf bytes.Buffer json.NewEncoder(&buf).Encode(cfg) diff --git a/test/norestart_test.go b/test/norestart_test.go index 976b9b179..e2d6e4d59 100644 --- a/test/norestart_test.go +++ b/test/norestart_test.go @@ -13,8 +13,9 @@ import ( "os" "testing" + "github.com/syncthing/syncthing/lib/fs" + "github.com/syncthing/syncthing/lib/config" - "github.com/syncthing/syncthing/lib/osutil" "github.com/syncthing/syncthing/lib/protocol" "github.com/syncthing/syncthing/lib/rc" ) @@ -51,7 +52,7 @@ func TestAddDeviceWithoutRestart(t *testing.T) { os.Remove("h4/config.xml.orig") os.Rename("h4/config.xml", "h4/config.xml.orig") - defer osutil.Rename("h4/config.xml.orig", "h4/config.xml") + defer os.Rename("h4/config.xml.orig", "h4/config.xml") cfg, err := p4.GetConfig() if err != nil { @@ -118,7 +119,7 @@ func TestFolderWithoutRestart(t *testing.T) { os.Remove("h1/config.xml.orig") os.Rename("h1/config.xml", "h1/config.xml.orig") - defer osutil.Rename("h1/config.xml.orig", "h1/config.xml") + defer os.Rename("h1/config.xml.orig", "h1/config.xml") cfg, err := p1.GetConfig() if err != nil { @@ -127,7 +128,8 @@ func TestFolderWithoutRestart(t *testing.T) { newFolder := config.FolderConfiguration{ ID: "testfolder", - RawPath: "testfolder-p1", + FilesystemType: fs.FilesystemTypeBasic, + Path: "testfolder-p1", RescanIntervalS: 86400, Copiers: 1, Hashers: 1, @@ -155,14 +157,14 @@ func TestFolderWithoutRestart(t *testing.T) { os.Remove("h4/config.xml.orig") os.Rename("h4/config.xml", "h4/config.xml.orig") - defer osutil.Rename("h4/config.xml.orig", "h4/config.xml") + defer os.Rename("h4/config.xml.orig", "h4/config.xml") cfg, err = p4.GetConfig() if err != nil { t.Fatal(err) } - newFolder.RawPath = "testfolder-p4" + newFolder.Path = "testfolder-p4" newFolder.Devices = []config.FolderDeviceConfiguration{{DeviceID: p1.ID()}} newDevice.DeviceID = p1.ID() newDevice.Name = "p1" diff --git a/test/override_test.go b/test/override_test.go index e52718b89..5eefd8f97 100644 --- a/test/override_test.go +++ b/test/override_test.go @@ -17,7 +17,6 @@ import ( "time" "github.com/syncthing/syncthing/lib/config" - "github.com/syncthing/syncthing/lib/osutil" "github.com/syncthing/syncthing/lib/protocol" "github.com/syncthing/syncthing/lib/rc" ) @@ -30,7 +29,7 @@ func TestOverride(t *testing.T) { fld.Type = config.FolderTypeSendOnly cfg.SetFolder(fld) os.Rename("h1/config.xml", "h1/config.xml.orig") - defer osutil.Rename("h1/config.xml.orig", "h1/config.xml") + defer os.Rename("h1/config.xml.orig", "h1/config.xml") cfg.Save() log.Println("Cleaning...") @@ -159,7 +158,7 @@ func TestOverrideIgnores(t *testing.T) { fld.ReadOnly = true cfg.SetFolder(fld) os.Rename("h1/config.xml", "h1/config.xml.orig") - defer osutil.Rename("h1/config.xml.orig", "h1/config.xml") + defer os.Rename("h1/config.xml.orig", "h1/config.xml") cfg.Save() log.Println("Cleaning...") diff --git a/test/util.go b/test/util.go index b3507cf35..7361a5b89 100644 --- a/test/util.go +++ b/test/util.go @@ -26,7 +26,6 @@ import ( "time" "unicode" - "github.com/syncthing/syncthing/lib/osutil" "github.com/syncthing/syncthing/lib/rc" ) @@ -188,7 +187,7 @@ func alterFiles(dir string) error { } newPath := filepath.Join(filepath.Dir(path), string(base)) if newPath != path { - return osutil.TryRename(path, newPath) + return os.Rename(path, newPath) } /* @@ -277,7 +276,7 @@ func (i *inifiteReader) Read(bs []byte) (int, error) { // rm -rf func removeAll(dirs ...string) error { for _, dir := range dirs { - files, err := osutil.Glob(dir) + files, err := filepath.Glob(dir) if err != nil { return err }