use monotonic now in TestDelNode

pull/6/head
zhouhaibing089 2016-05-15 10:58:16 +08:00 committed by haibzhou
parent 5df28fa18d
commit af3e2357ea
1 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,13 @@ func TestAddNode(t *testing.T) {
}
func TestDelNode(t *testing.T) {
defer func() { now = time.Now }()
var tick int64
now = func() time.Time {
t := time.Unix(tick, 0)
tick++
return t
}
evictor := NewRateLimitedTimedQueue(flowcontrol.NewFakeAlwaysRateLimiter())
evictor.Add("first")
evictor.Add("second")