File: describe_log_dirs_request_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 (33 lines) | stat: -rw-r--r-- 887 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
32
33
//go:build !functional

package sarama

import "testing"

var (
	emptyDescribeLogDirsRequest = []byte{255, 255, 255, 255} // Empty array (array length -1 sent)
	topicDescribeLogDirsRequest = []byte{
		0, 0, 0, 1, // DescribeTopics array, Array length 1
		0, 6, // Topic name length 6
		'r', 'a', 'n', 'd', 'o', 'm', // Topic name
		0, 0, 0, 2, // PartitionIDs int32 array, Array length 2
		0, 0, 0, 25, // PartitionID 25
		0, 0, 0, 26, // PartitionID 26
	}
)

func TestDescribeLogDirsRequest(t *testing.T) {
	request := &DescribeLogDirsRequest{
		Version:        0,
		DescribeTopics: []DescribeLogDirsRequestTopic{},
	}
	testRequest(t, "no topics", request, emptyDescribeLogDirsRequest)

	request.DescribeTopics = []DescribeLogDirsRequestTopic{
		{
			Topic:        "random",
			PartitionIDs: []int32{25, 26},
		},
	}
	testRequest(t, "no topics", request, topicDescribeLogDirsRequest)
}