forked from IBM/sarama
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_partitions_to_txn_request_test.go
More file actions
54 lines (47 loc) · 1.06 KB
/
Copy pathadd_partitions_to_txn_request_test.go
File metadata and controls
54 lines (47 loc) · 1.06 KB
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
//go:build !functional
package sarama
import "testing"
var (
addPartitionsToTxnRequest = []byte{
0, 3, 't', 'x', 'n',
0, 0, 0, 0, 0, 0, 31, 64, // ProducerID
0, 0, // ProducerEpoch
0, 0, 0, 1, // 1 topic
0, 5, 't', 'o', 'p', 'i', 'c',
0, 0, 0, 1, 0, 0, 0, 1,
}
addPartitionsToTxnRequestV3 = []byte{
4, 't', 'x', 'n',
0, 0, 0, 0, 0, 0, 31, 64, // ProducerID
0, 0, // ProducerEpoch
2, // 1 topic
6, 't', 'o', 'p', 'i', 'c',
2, // 1 partition
0, 0, 0, 1,
0,
0,
}
)
func TestAddPartitionsToTxnRequest(t *testing.T) {
req := &AddPartitionsToTxnRequest{
TransactionalID: "txn",
ProducerID: 8000,
ProducerEpoch: 0,
TopicPartitions: map[string][]int32{
"topic": {1},
},
}
testRequest(t, "", req, addPartitionsToTxnRequest)
}
func TestAddPartitionsToTxnRequestV3(t *testing.T) {
req := &AddPartitionsToTxnRequest{
Version: 3,
TransactionalID: "txn",
ProducerID: 8000,
ProducerEpoch: 0,
TopicPartitions: map[string][]int32{
"topic": {1},
},
}
testRequest(t, "", req, addPartitionsToTxnRequestV3)
}