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

Function testConnReadBatchWithNoMinMaxBytes

conn_test.go:577–606  ·  view source on GitHub ↗
(t *testing.T, conn *Conn)

Source from the content-addressed store, hash-verified

575}
576
577func testConnReadBatchWithNoMinMaxBytes(t *testing.T, conn *Conn) {
578 if _, err := conn.WriteMessages(makeTestSequence(10)...); err != nil {
579 t.Fatal(err)
580 }
581
582 value := make([]byte, 10e3) // 10 KB
583
584 batch := conn.ReadBatchWith(ReadBatchConfig{})
585
586 for i := 0; i < 10; i++ {
587 _, err := batch.Read(value)
588 if err != nil {
589 if err = batch.Close(); err != nil {
590 t.Fatalf("error trying to read batch message: %s", err)
591 }
592 }
593
594 if batch.HighWaterMark() != 10 {
595 t.Fatal("expected highest offset (watermark) to be 10")
596 }
597 }
598
599 if err := batch.Close(); err != nil {
600 t.Fatalf("error trying to close batch: %s", err)
601 }
602
603 if err := batch.Err(); err != nil {
604 t.Fatalf("broken batch: %s", err)
605 }
606}
607
608func testConnReadBatchWithMaxWait(t *testing.T, conn *Conn) {
609 if _, err := conn.WriteMessages(makeTestSequence(10)...); err != nil {

Callers

nothing calls this directly

Calls 7

makeTestSequenceFunction · 0.85
ReadBatchWithMethod · 0.80
HighWaterMarkMethod · 0.80
WriteMessagesMethod · 0.45
ReadMethod · 0.45
CloseMethod · 0.45
ErrMethod · 0.45

Tested by

no test coverage detected