| 13 | ) |
| 14 | |
| 15 | func 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 | |
| 50 | func TestClientOffsetCommit(t *testing.T) { |
| 51 | topic := makeTopic() |