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

Function TestClusterAdminCreateTopicWithInvalidTopicDetail

admin_test.go:93–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestClusterAdminCreateTopicWithInvalidTopicDetail(t *testing.T) {
94 seedBroker := NewMockBroker(t, 1)
95 defer seedBroker.Close()
96
97 seedBroker.SetHandlerByMap(map[string]MockResponse{
98 "MetadataRequest": NewMockMetadataResponse(t).
99 SetController(seedBroker.BrokerID()).
100 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()),
101 "CreateTopicsRequest": NewMockCreateTopicsResponse(t),
102 })
103
104 config := NewTestConfig()
105 config.Version = V0_10_2_0
106 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
107 if err != nil {
108 t.Fatal(err)
109 }
110
111 err = admin.CreateTopic("my_topic", nil, false)
112 if err.Error() != "you must specify topic details" {
113 t.Fatal(err)
114 }
115 err = admin.Close()
116 if err != nil {
117 t.Fatal(err)
118 }
119}
120
121func TestClusterAdminCreateTopicWithoutAuthorization(t *testing.T) {
122 seedBroker := NewMockBroker(t, 1)

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
SetHandlerByMapMethod · 0.95
BrokerIDMethod · 0.95
AddrMethod · 0.95
CreateTopicMethod · 0.95
CloseMethod · 0.95
NewMockBrokerFunction · 0.85
NewMockMetadataResponseFunction · 0.85
NewClusterAdminFunction · 0.85
SetBrokerMethod · 0.80
SetControllerMethod · 0.80

Tested by

no test coverage detected