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

Function TestListGroupsResponseV1

listgroups_test.go:13–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestListGroupsResponseV1(t *testing.T) {
14 item := listGroupsResponseV1{
15 ErrorCode: 2,
16 Groups: []listGroupsResponseGroupV1{
17 {
18 GroupID: "a",
19 ProtocolType: "b",
20 },
21 },
22 }
23
24 b := bytes.NewBuffer(nil)
25 w := &writeBuffer{w: b}
26 item.writeTo(w)
27
28 var found listGroupsResponseV1
29 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
30 if err != nil {
31 t.Error(err)
32 t.FailNow()
33 }
34 if remain != 0 {
35 t.Errorf("expected 0 remain, got %v", remain)
36 t.FailNow()
37 }
38 if !reflect.DeepEqual(item, found) {
39 t.Error("expected item and found to be the same")
40 t.FailNow()
41 }
42}
43
44func TestClientListGroups(t *testing.T) {
45 client, shutdown := newLocalClient()

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