summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-01-17 14:57:59 -0800
committer Colin Cross <ccross@android.com> 2024-01-18 13:23:06 -0800
commitb82821340221ab665b3643af464e927c726bb6ee (patch)
tree2ff2cc7dfe31abf620187421209b0cd56d5450af
parent84ed511cebcf664eb15602a41bf74bc0f3e3440e (diff)
Fix data race in finder_test.go
Wait for newFinder to finish writing its dump before ticking the clock. Test: go test -race ./... Change-Id: Ib7527ebfb4e1c989deefdb0779a4f9c0928ae15d
-rw-r--r--finder/finder_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/finder/finder_test.go b/finder/finder_test.go
index 8f73719a6..be22d13b6 100644
--- a/finder/finder_test.go
+++ b/finder/finder_test.go
@@ -813,6 +813,7 @@ func TestFileAdded(t *testing.T) {
IncludeFiles: []string{"findme.txt"},
},
)
+ finder.WaitForDbDump()
filesystem.Clock.Tick()
foundPaths := finder.FindNamedAt("/tmp", "findme.txt")
finder.Shutdown()
@@ -1445,6 +1446,7 @@ func TestUpdatingDbIffChanged(t *testing.T) {
IncludeFiles: []string{"hi.txt"},
},
)
+ finder.WaitForDbDump()
filesystem.Clock.Tick()
foundPaths := finder.FindAll()
finder.Shutdown()
@@ -1506,6 +1508,7 @@ func TestDirectoryNotPermitted(t *testing.T) {
IncludeFiles: []string{"hi.txt"},
},
)
+ finder.WaitForDbDump()
filesystem.Clock.Tick()
foundPaths := finder.FindAll()
finder.Shutdown()
@@ -1552,6 +1555,7 @@ func TestFileNotPermitted(t *testing.T) {
IncludeFiles: []string{"hi.txt"},
},
)
+ finder.WaitForDbDump()
filesystem.Clock.Tick()
foundPaths := finder.FindAll()
finder.Shutdown()
@@ -1573,6 +1577,7 @@ func TestCacheEntryPathUnexpectedError(t *testing.T) {
IncludeFiles: []string{"hi.txt"},
},
)
+ finder.WaitForDbDump()
filesystem.Clock.Tick()
foundPaths := finder.FindAll()
finder.Shutdown()