File: list_partition_reassignments_response_test.go

package info (click to toggle)
golang-github-ibm-sarama 1.45.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,964 kB
  • sloc: makefile: 35; sh: 19
file content (30 lines) | stat: -rw-r--r-- 984 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//go:build !functional

package sarama

import "testing"

var listPartitionReassignmentsResponse = []byte{
	0, 0, 39, 16, // ThrottleTimeMs 10000
	0, 0, // errorcode
	0,                         // null string
	2,                         // block array length 1
	6, 116, 111, 112, 105, 99, // topic name "topic"
	2,          // partition array length 1
	0, 0, 0, 1, // partitionId
	3, 0, 0, 3, 232, 0, 0, 3, 233, // replicas [1000, 1001]
	3, 0, 0, 3, 234, 0, 0, 3, 235, // addingReplicas [1002, 1003]
	3, 0, 0, 3, 236, 0, 0, 3, 237, // addingReplicas [1004, 1005]
	0, 0, 0, // empty tagged fields
}

func TestListPartitionReassignmentResponse(t *testing.T) {
	var response *ListPartitionReassignmentsResponse = &ListPartitionReassignmentsResponse{
		ThrottleTimeMs: int32(10000),
		Version:        int16(0),
	}

	response.AddBlock("topic", 1, []int32{1000, 1001}, []int32{1002, 1003}, []int32{1004, 1005})

	testResponse(t, "one topic", response, listPartitionReassignmentsResponse)
}