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

Function TestOffsetCommitResponseV2

offsetcommit_test.go:15–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestOffsetCommitResponseV2(t *testing.T) {
16 item := offsetCommitResponseV2{
17 Responses: []offsetCommitResponseV2Response{
18 {
19 Topic: "a",
20 PartitionResponses: []offsetCommitResponseV2PartitionResponse{
21 {
22 Partition: 1,
23 ErrorCode: 2,
24 },
25 },
26 },
27 },
28 }
29
30 b := bytes.NewBuffer(nil)
31 w := &writeBuffer{w: b}
32 item.writeTo(w)
33
34 var found offsetCommitResponseV2
35 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
36 if err != nil {
37 t.Error(err)
38 t.FailNow()
39 }
40 if remain != 0 {
41 t.Errorf("expected 0 remain, got %v", remain)
42 t.FailNow()
43 }
44 if !reflect.DeepEqual(item, found) {
45 t.Error("expected item and found to be the same")
46 t.FailNow()
47 }
48}
49
50func TestClientOffsetCommit(t *testing.T) {
51 topic := makeTopic()

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