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

Function TestGroupAssignment

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

Source from the content-addressed store, hash-verified

157}
158
159func TestGroupAssignment(t *testing.T) {
160 item := groupAssignment{
161 Version: 1,
162 Topics: map[string][]int32{
163 "a": {1, 2, 3},
164 "b": {4, 5},
165 },
166 UserData: []byte(`blah`),
167 }
168
169 b := bytes.NewBuffer(nil)
170 w := &writeBuffer{w: b}
171 item.writeTo(w)
172
173 var found groupAssignment
174 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
175 if err != nil {
176 t.Error(err)
177 t.FailNow()
178 }
179 if remain != 0 {
180 t.Errorf("expected 0 remain, got %v", remain)
181 t.FailNow()
182 }
183 if !reflect.DeepEqual(item, found) {
184 t.Error("expected item and found to be the same")
185 t.FailNow()
186 }
187}
188
189func TestGroupAssignmentReadsFromZeroSize(t *testing.T) {
190 var item groupAssignment

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