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

Function newLocalClientWithTopic

topics/list_topics_test.go:48–60  ·  view source on GitHub ↗
(topic string, partitions int)

Source from the content-addressed store, hash-verified

46}
47
48func newLocalClientWithTopic(topic string, partitions int) (*kafka.Client, func()) {
49 client, shutdown := newLocalClient()
50 if err := clientCreateTopic(client, topic, partitions); err != nil {
51 shutdown()
52 panic(err)
53 }
54 return client, func() {
55 client.DeleteTopics(context.Background(), &kafka.DeleteTopicsRequest{
56 Topics: []string{topic},
57 })
58 shutdown()
59 }
60}
61
62func clientCreateTopic(client *kafka.Client, topic string, partitions int) error {
63 _, err := client.CreateTopics(context.Background(), &kafka.CreateTopicsRequest{

Callers 1

TestListReFunction · 0.70

Calls 3

newLocalClientFunction · 0.70
clientCreateTopicFunction · 0.70
DeleteTopicsMethod · 0.45

Tested by

no test coverage detected