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

Function TestErrorCannotConnect

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

Source from the content-addressed store, hash-verified

1687)
1688
1689func TestErrorCannotConnect(t *testing.T) {
1690 r := NewReader(ReaderConfig{
1691 Brokers: []string{"localhost:9093"},
1692 Dialer: &Dialer{Timeout: connTO},
1693 MaxAttempts: 1,
1694 Topic: makeTopic(),
1695 })
1696 ctx, cancel := context.WithTimeout(context.Background(), connTestTO)
1697 defer cancel()
1698
1699 _, err := r.FetchMessage(ctx)
1700 if err == nil || ctx.Err() != nil {
1701 t.Errorf("Reader.FetchMessage must fail when it cannot " +
1702 "connect")
1703 }
1704}
1705
1706func TestErrorCannotConnectGroupSubscription(t *testing.T) {
1707 r := NewReader(ReaderConfig{

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