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

Function testConnWriteBatchReadSequentially

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

Source from the content-addressed store, hash-verified

522}
523
524func testConnWriteBatchReadSequentially(t *testing.T, conn *Conn) {
525 msgs := makeTestSequence(10)
526
527 if _, err := conn.WriteMessages(msgs...); err != nil {
528 t.Fatal(err)
529 }
530
531 for i := 0; i != 10; i++ {
532 msg, err := conn.ReadMessage(128)
533 if err != nil {
534 t.Error(err)
535 continue
536 }
537 if !bytes.Equal(msg.Key, msgs[i].Key) {
538 t.Errorf("bad message key at offset %d: %q != %q", i, msg.Key, msgs[i].Key)
539 }
540 if !bytes.Equal(msg.Value, msgs[i].Value) {
541 t.Errorf("bad message value at offset %d: %q != %q", i, msg.Value, msgs[i].Value)
542 }
543 if !msg.Time.Equal(msgs[i].Time) {
544 t.Errorf("bad message time at offset %d: %s != %s", i, msg.Time, msgs[i].Time)
545 }
546 }
547}
548
549func testConnReadWatermarkFromBatch(t *testing.T, conn *Conn) {
550 if _, err := conn.WriteMessages(makeTestSequence(10)...); err != nil {

Callers

nothing calls this directly

Calls 4

makeTestSequenceFunction · 0.85
WriteMessagesMethod · 0.45
ReadMessageMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected