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

Function TestHeartbeatRequestV0

heartbeat_test.go:59–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestHeartbeatRequestV0(t *testing.T) {
60 item := heartbeatResponseV0{
61 ErrorCode: 2,
62 }
63
64 b := bytes.NewBuffer(nil)
65 w := &writeBuffer{w: b}
66 item.writeTo(w)
67
68 var found heartbeatResponseV0
69 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
70 if err != nil {
71 t.Error(err)
72 t.FailNow()
73 }
74 if remain != 0 {
75 t.Errorf("expected 0 remain, got %v", remain)
76 t.FailNow()
77 }
78 if !reflect.DeepEqual(item, found) {
79 t.Error("expected item and found to be the same")
80 t.FailNow()
81 }
82}

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