// TestTaskPanic ensures panics from Run methods are turned into Done calls.
TestTaskPanic ensures panics from Run methods are turned into Done calls.
// TestTaskPanic ensures panics from Run methods are turned into Done calls .
func TestTaskPanic(t *testing.T) {
	t.Parallel()
	hf := SimpleHandler(func(Task, <-chan bool) bool {
		panic("TestTaskPanic")
	})
	coord := NewTestCoord()
	c, _ := NewConsumer(coord, hf, DumbBalancer)
	go c.Run()
	coord.Tasks <- testTask{"1"}
	coord.Tasks <- testTask{"2"}
	coord.Tasks <- testTask{"3"}
	for i := 3; i > 0; i-- {
		select {
		case task := <-coord.Dones:
			t.Logf("%s done", task)
		case task := <-coord.Releases:
			t.Errorf("%s released when it should have been marked Done!", task)
		case <-time.After(200 * time.Millisecond):
			t.Fatalf("Took too long to mark task(s) as done.")
		}
	}
	c.Shutdown()
}
func TestTaskPanic ( t * testing . T ) { t . Parallel ( ) hf := SimpleHandler ( func ( Task , <- chan bool ) bool { panic ( " " ) } ) coord := NewTestCoord ( ) c , _ := NewConsumer ( coord , hf , DumbBalancer ) go c . Run ( ) coord . Tasks <- testTask { " " } coord . Tasks <- testTask { " " } coord . Tasks <- testTask { " " } for i := 3 ; i > 0 ; i -- { select { case task := <- coord . Dones : t . Logf ( " " , task ) case task := <- coord . Releases : t . Errorf ( " " , task ) case <- time . After ( 200 * time . Millisecond ) : t . Fatalf ( " " ) } } c . Shutdown ( ) }
TestTaskPanic ensures panics from Run methods are turned into Done calls.
TestTaskPanic ensures panics from Run methods are turned into Done calls .