chore: remove directive for tests (#3257)

This commit is contained in:
Kevin Wan
2023-05-18 21:34:33 +08:00
committed by GitHub
parent f7228e9af1
commit 90839965fa
3 changed files with 35 additions and 14 deletions

View File

@@ -1,6 +1,3 @@
//go:build !race
// Disable data race detection is because of the timingWheel in cacheNode.
package cache
import (
@@ -58,16 +55,16 @@ func TestCacheNode_DelCache(t *testing.T) {
})
t.Run("del cache with errors", func(t *testing.T) {
old := timingWheel
old := timingWheel.Load()
ticker := timex.NewFakeTicker()
var err error
timingWheel, err = collection.NewTimingWheelWithTicker(
tw, err := collection.NewTimingWheelWithTicker(
time.Millisecond, timingWheelSlots, func(key, value any) {
clean(key, value)
}, ticker)
timingWheel.Store(tw)
assert.NoError(t, err)
t.Cleanup(func() {
timingWheel = old
timingWheel.Store(old)
})
r, err := miniredis.Run()