From 42de53c6c9d9e5129fbc078bef29b42ddba140b9 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Sat, 3 Oct 2020 20:46:17 +0200 Subject: [PATCH] lib/model: Fix race in GlobalDirectory tests (fixes #7021) (#7022) --- lib/model/model_test.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/model/model_test.go b/lib/model/model_test.go index 5fec5829b..05cc05b7d 100644 --- a/lib/model/model_test.go +++ b/lib/model/model_test.go @@ -1665,10 +1665,9 @@ func TestRWScanRecovery(t *testing.T) { } func TestGlobalDirectoryTree(t *testing.T) { - db := db.NewLowlevel(backend.OpenMemory()) - m := newModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil) - m.ServeBackground() - defer cleanupModel(m) + w, fcfg := tmpDefaultWrapper() + m := setupModel(w) + defer cleanupModelAndRemoveDir(m, fcfg.Filesystem().URI()) b := func(isfile bool, path ...string) protocol.FileInfo { typ := protocol.FileInfoTypeDirectory @@ -1916,10 +1915,9 @@ func TestGlobalDirectoryTree(t *testing.T) { } func TestGlobalDirectorySelfFixing(t *testing.T) { - db := db.NewLowlevel(backend.OpenMemory()) - m := newModel(defaultCfgWrapper, myID, "syncthing", "dev", db, nil) - m.ServeBackground() - defer cleanupModel(m) + w, fcfg := tmpDefaultWrapper() + m := setupModel(w) + defer cleanupModelAndRemoveDir(m, fcfg.Filesystem().URI()) b := func(isfile bool, path ...string) protocol.FileInfo { typ := protocol.FileInfoTypeDirectory