Example #1
0
func waitForClock(c *gc.C, clock *testing.Clock) {
	select {
	case <-clock.Alarms():
	case <-time.After(coretesting.LongWait):
		c.Fatal("timed out waiting for clock")
	}
}
Example #2
0
func waitAlarm(c *gc.C, clock *jujutesting.Clock) {
	select {
	case <-time.After(testing.LongWait):
		c.Fatalf("alarm never set")
	case <-clock.Alarms():
	}
}
Example #3
0
// WaitAlarms waits until the supplied clock has sent count values on
// its Alarms channel.
func WaitAlarms(c *gc.C, clock *testing.Clock, count int) {
	timeout := time.After(jujutesting.LongWait)
	for i := 0; i < count; i++ {
		select {
		case <-timeout:
			c.Fatalf("never saw alarm %d", i)
		case <-clock.Alarms():
		}
	}
}
Example #4
0
func waitAlarms(c *gc.C, clock *testing.Clock, count int) {
	timeout := time.After(coretesting.LongWait)
	for i := 0; i < count; i++ {
		select {
		case <-clock.Alarms():
		case <-timeout:
			c.Fatalf("timed out waiting for %dth alarm set", i)
		}
	}
}