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

Function TestErrorCannotConnectGroupSubscription

reader_test.go:1706–1722  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1704}
1705
1706func TestErrorCannotConnectGroupSubscription(t *testing.T) {
1707 r := NewReader(ReaderConfig{
1708 Brokers: []string{"localhost:9093"},
1709 Dialer: &Dialer{Timeout: 1 * time.Second},
1710 GroupID: "foobar",
1711 MaxAttempts: 1,
1712 Topic: makeTopic(),
1713 })
1714 ctx, cancel := context.WithTimeout(context.Background(), connTestTO)
1715 defer cancel()
1716
1717 _, err := r.FetchMessage(ctx)
1718 if err == nil || ctx.Err() != nil {
1719 t.Errorf("Reader.FetchMessage with a group subscription " +
1720 "must fail when it cannot connect")
1721 }
1722}
1723
1724// Tests that the reader can handle messages where the response is truncated
1725// due to reaching MaxBytes.

Callers

nothing calls this directly

Calls 4

FetchMessageMethod · 0.95
NewReaderFunction · 0.85
makeTopicFunction · 0.70
ErrMethod · 0.45

Tested by

no test coverage detected