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

Function TestSyncGroupResponseV0

syncgroup_test.go:205–229  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

203}
204
205func TestSyncGroupResponseV0(t *testing.T) {
206 item := syncGroupResponseV0{
207 ErrorCode: 2,
208 MemberAssignments: []byte(`blah`),
209 }
210
211 b := bytes.NewBuffer(nil)
212 w := &writeBuffer{w: b}
213 item.writeTo(w)
214
215 var found syncGroupResponseV0
216 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
217 if err != nil {
218 t.Error(err)
219 t.FailNow()
220 }
221 if remain != 0 {
222 t.Errorf("expected 0 remain, got %v", remain)
223 t.FailNow()
224 }
225 if !reflect.DeepEqual(item, found) {
226 t.Error("expected item and found to be the same")
227 t.FailNow()
228 }
229}
230
231func BenchmarkSyncGroupResponseV0(t *testing.B) {
232 item := syncGroupResponseV0{

Callers

nothing calls this directly

Calls 5

writeToMethod · 0.95
NewReaderMethod · 0.65
LenMethod · 0.65
readFromMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected