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

Function assertRecords

protocol/record_batch_test.go:141–163  ·  view source on GitHub ↗
(t *testing.T, r1, r2 RecordReader)

Source from the content-addressed store, hash-verified

139}
140
141func assertRecords(t *testing.T, r1, r2 RecordReader) {
142 t.Helper()
143
144 for {
145 rec1, err1 := r1.ReadRecord()
146 rec2, err2 := r2.ReadRecord()
147
148 if err1 != nil || err2 != nil {
149 if !errors.Is(err1, err2) {
150 t.Error("errors mismatch:")
151 t.Log("expected:", err2)
152 t.Log("found: ", err1)
153 }
154 return
155 }
156
157 if !equalRecords(rec1, rec2) {
158 t.Error("records mismatch:")
159 t.Logf("expected: %+v", rec2)
160 t.Logf("found: %+v", rec1)
161 }
162 }
163}
164
165func equalRecords(r1, r2 *Record) bool {
166 if r1.Offset != r2.Offset {

Callers 2

TestRecordReaderFunction · 0.70
TestMultiRecordReaderFunction · 0.70

Calls 3

equalRecordsFunction · 0.85
ReadRecordMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected