Commit 216bd2ce authored by Janoš Guljaš's avatar Janoš Guljaš Committed by Viktor Trón

swarm/storage/localstore: fix testDB_collectGarbageWorker data race (#19206)

parent a1099bb7
...@@ -51,14 +51,16 @@ func testDB_collectGarbageWorker(t *testing.T) { ...@@ -51,14 +51,16 @@ func testDB_collectGarbageWorker(t *testing.T) {
chunkCount := 150 chunkCount := 150
testHookCollectGarbageChan := make(chan int64)
defer setTestHookCollectGarbage(func(collectedCount int64) {
testHookCollectGarbageChan <- collectedCount
})()
db, cleanupFunc := newTestDB(t, &Options{ db, cleanupFunc := newTestDB(t, &Options{
Capacity: 100, Capacity: 100,
}) })
testHookCollectGarbageChan := make(chan int64)
defer setTestHookCollectGarbage(func(collectedCount int64) {
select {
case testHookCollectGarbageChan <- collectedCount:
case <-db.close:
}
})()
defer cleanupFunc() defer cleanupFunc()
uploader := db.NewPutter(ModePutUpload) uploader := db.NewPutter(ModePutUpload)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment