From 3a75b637763e9fa2de97975ebca4346c8708c798 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Thu, 7 Mar 2019 16:34:41 +0100 Subject: [PATCH] lib/model: Use temp dir from osutils in tests (#5581) --- lib/model/model_test.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/model/model_test.go b/lib/model/model_test.go index cbb2d8bf4..2d76540d9 100644 --- a/lib/model/model_test.go +++ b/lib/model/model_test.go @@ -43,7 +43,6 @@ var defaultFolderConfig config.FolderConfiguration var defaultFs fs.Filesystem var defaultCfg config.Configuration var defaultAutoAcceptCfg config.Configuration -var tmpLocation string func init() { myID, _ = protocol.DeviceIDFromString("ZNWFSWE-RWRV2BD-45BLMCV-LTDE2UR-4LJDW6J-R5BPWEB-TXD27XJ-IZF5RA4") @@ -116,14 +115,6 @@ func init() { } func TestMain(m *testing.M) { - tmpLocation = "/tmp" - if runtime.GOOS == "windows" { - tmpLocation = "test-tmp" - if err := os.MkdirAll(tmpLocation, 0777); err != nil { - panic(err) - } - } - tmpName, err := prepareTmpFile(defaultFs) if err != nil { panic(err) @@ -134,7 +125,6 @@ func TestMain(m *testing.M) { os.Remove(defaultCfgWrapper.ConfigPath()) defaultFs.Remove(tmpName) defaultFs.RemoveAll(config.DefaultMarkerName) - defaultFs.RemoveAll(tmpLocation) os.Exit(exitCode) } @@ -162,7 +152,7 @@ func prepareTmpFile(to fs.Filesystem) (string, error) { } func createTmpWrapper(cfg config.Configuration) config.Wrapper { - tmpFile, err := ioutil.TempFile(tmpLocation, "syncthing-testConfig-") + tmpFile, err := ioutil.TempFile("", "syncthing-testConfig-") if err != nil { panic(err) }