File: elect_leaders_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 (31 lines) | stat: -rw-r--r-- 736 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
31
//go:build !functional

package sarama

import "testing"

var electLeadersResponseOneTopic = []byte{
	0, 0, 3, 232, // ThrottleTimeMs 1000
	0, 0, // errorCode
	2,                         // number of topics
	6, 116, 111, 112, 105, 99, // topic name "topic"
	2,          // number of partitions
	0, 0, 0, 0, // partition 0
	0, 0, // empty tagged fields
	0, 0, // empty tagged fields
	0, 0, // empty tagged fields
}

func TestElectLeadersResponse(t *testing.T) {
	var response = &ElectLeadersResponse{
		Version:        int16(2),
		ThrottleTimeMs: int32(1000),
		ReplicaElectionResults: map[string]map[int32]*PartitionResult{
			"topic": {
				0: {},
			},
		},
	}

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