MCPcopy
hub / github.com/IBM/sarama / TestOffsetFetchRequestAllPartitions

Function TestOffsetFetchRequestAllPartitions

offset_fetch_request_test.go:258–283  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

256}
257
258func TestOffsetFetchRequestAllPartitions(t *testing.T) {
259 for version := 2; version <= 5; version++ {
260 request := &OffsetFetchRequest{Version: int16(version), ConsumerGroup: "blah"}
261 testRequest(t, fmt.Sprintf("all partitions %d", version), request, offsetFetchRequestAllPartitions)
262 }
263
264 { // v8
265 request := &OffsetFetchRequest{
266 Version: 8,
267 Groups: []OffsetFetchRequestGroup{
268 {GroupId: "blah", Partitions: nil},
269 },
270 }
271 testRequest(t, "all partitions 8", request, offsetFetchRequestAllPartitionsV8)
272 }
273
274 { // decoded v8 null topics array
275 request := new(OffsetFetchRequest)
276 require.NoError(t, versionedDecode(offsetFetchRequestAllPartitionsV8, request, 8, nil))
277 require.Len(t, request.Groups, 1)
278 assert.Nil(t, request.Groups[0].Partitions)
279
280 packet := testRequestEncode(t, "decoded all partitions 8", request, offsetFetchRequestAllPartitionsV8)
281 testRequestDecode(t, "decoded all partitions 8", request, packet)
282 }
283}
284
285func TestNewOffsetFetchRequestDowngrade(t *testing.T) {
286 request := NewOffsetFetchRequest(V3_0_0_0, "blah", map[string][]int32{"topicTheFirst": {0x4F4F4F4F}})

Callers

nothing calls this directly

Calls 5

testRequestFunction · 0.85
versionedDecodeFunction · 0.85
testRequestEncodeFunction · 0.85
testRequestDecodeFunction · 0.85
LenMethod · 0.45

Tested by

no test coverage detected