MCPcopy
hub / github.com/segmentio/kafka-go / TestClientCreatePartitions

Function TestClientCreatePartitions

createpartitions_test.go:10–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestClientCreatePartitions(t *testing.T) {
11 if !ktesting.KafkaIsAtLeast("1.0.1") {
12 return
13 }
14
15 client, shutdown := newLocalClient()
16 defer shutdown()
17
18 topic := makeTopic()
19 createTopic(t, topic, 1)
20 defer deleteTopic(t, topic)
21
22 res, err := client.CreatePartitions(context.Background(), &CreatePartitionsRequest{
23 Topics: []TopicPartitionsConfig{
24 {
25 Name: topic,
26 Count: 2,
27 TopicPartitionAssignments: []TopicPartitionAssignment{
28 {
29 BrokerIDs: []int32{1},
30 },
31 },
32 },
33 },
34 ValidateOnly: false,
35 })
36 if err != nil {
37 t.Fatal(err)
38 }
39
40 if err := res.Errors[topic]; err != nil {
41 t.Error(err)
42 }
43}
44
45func TestClientCreatePartitionsNoAssignments(t *testing.T) {
46 if !ktesting.KafkaIsAtLeast("1.0.1") {

Callers

nothing calls this directly

Calls 6

createTopicFunction · 0.85
deleteTopicFunction · 0.85
CreatePartitionsMethod · 0.80
newLocalClientFunction · 0.70
makeTopicFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected