MCPcopy Create free account
hub / github.com/apache/pulsar-client-go / TestCreateTopic

Function TestCreateTopic

pulsaradmin/pkg/admin/topic_test.go:39–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37)
38
39func TestCreateTopic(t *testing.T) {
40 checkError := func(err error) {
41 if err != nil {
42 t.Error(err)
43 }
44 }
45
46 cfg := &config.Config{}
47 admin, err := New(cfg)
48 checkError(err)
49
50 topic := "persistent://public/default/testCreateTopic"
51
52 topicName, err := utils.GetTopicName(topic)
53 checkError(err)
54
55 err = admin.Topics().Create(*topicName, 0)
56 checkError(err)
57
58 topicLists, err := admin.Namespaces().GetTopics("public/default")
59 checkError(err)
60
61 for _, t := range topicLists {
62 if t == topic {
63 return
64 }
65 }
66 t.Error("Couldn't find topic: " + topic)
67}
68
69func TestTopics_Properties(t *testing.T) {
70 t.Run("NonPartitioned", func(t *testing.T) {

Callers

nothing calls this directly

Calls 7

GetTopicNameFunction · 0.92
NewFunction · 0.85
ErrorMethod · 0.65
CreateMethod · 0.65
TopicsMethod · 0.65
GetTopicsMethod · 0.65
NamespacesMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…