MCPcopy
hub / github.com/segmentio/kafka-go / TestGenerationStartsFunctionAfterClosed

Function TestGenerationStartsFunctionAfterClosed

consumergroup_test.go:661–686  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

659}
660
661func TestGenerationStartsFunctionAfterClosed(t *testing.T) {
662 gen := Generation{
663 conn: &mockCoordinator{},
664 done: make(chan struct{}),
665 joined: make(chan struct{}),
666 log: func(func(Logger)) {},
667 logError: func(func(Logger)) {},
668 }
669
670 gen.close()
671
672 ch := make(chan error)
673 gen.Start(func(ctx context.Context) {
674 <-ctx.Done()
675 ch <- ctx.Err()
676 })
677
678 select {
679 case <-time.After(time.Second):
680 t.Fatal("timed out waiting for func to run")
681 case err := <-ch:
682 if !errors.Is(err, ErrGenerationEnded) {
683 t.Fatalf("expected %v but got %v", ErrGenerationEnded, err)
684 }
685 }
686}

Callers

nothing calls this directly

Calls 4

closeMethod · 0.95
StartMethod · 0.95
DoneMethod · 0.80
ErrMethod · 0.45

Tested by

no test coverage detected