func assertNextOp(c *gc.C, s *timequeue.Queue, clock *coretesting.Clock, d time.Duration) { next := s.Next() c.Assert(next, gc.NotNil) if d > 0 { select { case <-next: c.Fatal("Next channel signalled too soon") default: } } // temporarily move time forward clock.Advance(d) defer clock.Advance(-d) select { case _, ok := <-next: c.Assert(ok, jc.IsTrue) // the time value is unimportant to us default: c.Fatal("Next channel not signalled") } }
func assertReady(c *gc.C, s *timequeue.Queue, clock *coretesting.Clock, expect ...interface{}) { ready := s.Ready(clock.Now()) c.Assert(ready, jc.DeepEquals, expect) }