-
Notifications
You must be signed in to change notification settings - Fork 18
/
alter_partition_reassignments_response_test.go
55 lines (49 loc) · 1.22 KB
/
alter_partition_reassignments_response_test.go
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package healer
import (
"testing"
"github.com/smartystreets/goconvey/convey"
)
func TestAlterPartitionReassignmentResponse(t *testing.T) {
convey.Convey("Test AlterPartitionReassignmentResponse Encode and Decode", t, func() {
var errorMsg string = "mock error"
var version uint16 = 0
header := NewResponseHeader(API_AlterPartitionReassignments, 0)
header.CorrelationID = 1
header.TaggedFields = TaggedFields{
{
Tag: 1,
Data: []byte("hello"),
},
{
Tag: 2,
Data: []byte("healer"),
},
}
response := AlterPartitionReassignmentsResponse{
ResponseHeader: header,
ErrorCode: 1,
ErrorMsg: &errorMsg,
Responses: []*alterPartitionReassignmentsResponseTopic{
{
Name: "test-topic",
Partitions: []*alterPartitionReassignmentsResponseTopicPartition{
{
PartitionID: 1,
ErrorCode: 1,
ErrorMsg: &errorMsg,
},
{
PartitionID: 2,
ErrorCode: 2,
ErrorMsg: &errorMsg,
},
},
},
},
}
encoded := response.Encode(version)
decoded, err := NewAlterPartitionReassignmentsResponse(encoded, version)
convey.So(err, convey.ShouldBeNil)
convey.So(*decoded, convey.ShouldResemble, response)
})
}