Exemple #1
0
func (*WorkerSuite) TestDeadAlready(c *gc.C) {
	w := workertest.NewDeadWorker(nil)

	select {
	case _, ok := <-worker.Dead(w):
		c.Check(ok, jc.IsFalse)
	case <-time.After(coretesting.LongWait):
		c.Fatalf("Dead never sent")
	}
}
Exemple #2
0
func (*WorkerSuite) TestDeadWaits(c *gc.C) {
	w := workertest.NewErrorWorker(nil)
	defer workertest.CleanKill(c, w)

	dead := worker.Dead(w)
	select {
	case <-time.After(coretesting.ShortWait):
	case _, ok := <-dead:
		if !ok {
			c.Fatalf("Dead closed early")
		} else {
			c.Fatalf("Dead sent unexpectedly")
		}
	}

	w.Kill()
	select {
	case _, ok := <-dead:
		c.Check(ok, jc.IsFalse)
	case <-time.After(coretesting.LongWait):
		c.Fatalf("Dead never closed")
	}
}
Exemple #3
0
func (r *leaseWorkerReplacer) needed() <-chan struct{} {
	return worker.Dead(r.current)
}