You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
513 B
Go
29 lines
513 B
Go
package cache
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/zeromicro/go-zero/core/timex"
|
|
)
|
|
|
|
func TestCacheStat_statLoop(t *testing.T) {
|
|
t.Run("stat loop total 0", func(t *testing.T) {
|
|
var stat Stat
|
|
ticker := timex.NewFakeTicker()
|
|
go stat.statLoop(ticker)
|
|
ticker.Tick()
|
|
ticker.Tick()
|
|
ticker.Stop()
|
|
})
|
|
|
|
t.Run("stat loop total not 0", func(t *testing.T) {
|
|
var stat Stat
|
|
stat.IncrementTotal()
|
|
ticker := timex.NewFakeTicker()
|
|
go stat.statLoop(ticker)
|
|
ticker.Tick()
|
|
ticker.Tick()
|
|
ticker.Stop()
|
|
})
|
|
}
|