MCPcopy
hub / github.com/IBM/sarama / TestCreatePartitionsRequest

Function TestCreatePartitionsRequest

create_partitions_request_test.go:51–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49)
50
51func TestCreatePartitionsRequest(t *testing.T) {
52 req := &CreatePartitionsRequest{
53 TopicPartitions: map[string]*TopicPartition{
54 "topic": {
55 Count: 3,
56 },
57 },
58 Timeout: 100 * time.Millisecond,
59 }
60
61 buf := testRequestEncode(t, "no assignment", req, createPartitionRequestNoAssignment)
62 testRequestDecode(t, "no assignment", req, buf)
63
64 req.ValidateOnly = true
65 req.TopicPartitions["topic"].Assignment = [][]int32{{2, 3}, {3, 1}}
66
67 buf = testRequestEncode(t, "assignment", req, createPartitionRequestAssignment)
68 testRequestDecode(t, "assignment", req, buf)
69
70 req.Version = 2
71 buf = testRequestEncode(t, "assignment v2", req, createPartitionRequestAssignmentV2)
72 testRequestDecode(t, "assignment v2", req, buf)
73
74 // v3 wire format is identical to v2
75 req.Version = 3
76 buf = testRequestEncode(t, "assignment v3", req, createPartitionRequestAssignmentV2)
77 testRequestDecode(t, "assignment v3", req, buf)
78}

Callers

nothing calls this directly

Calls 2

testRequestEncodeFunction · 0.85
testRequestDecodeFunction · 0.85

Tested by

no test coverage detected