MCPcopy Create free account
hub / github.com/IBM/sarama / TestClusterAdminCreateTopicWithInvalidTopicDetail

Function TestClusterAdminCreateTopicWithInvalidTopicDetail

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

Source from the content-addressed store, hash-verified

155}
156
157func TestClusterAdminCreateTopicWithInvalidTopicDetail(t *testing.T) {
158 seedBroker := NewMockBroker(t, 1)
159 defer seedBroker.Close()
160
161 seedBroker.SetHandlerByMap(map[string]MockResponse{
162 "MetadataRequest": NewMockMetadataResponse(t).
163 SetController(seedBroker.BrokerID()).
164 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()),
165 "CreateTopicsRequest": NewMockCreateTopicsResponse(t),
166 })
167
168 config := NewTestConfig()
169 config.Version = V0_10_2_0
170 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
171 if err != nil {
172 t.Fatal(err)
173 }
174
175 err = admin.CreateTopic("my_topic", nil, false)
176 if err.Error() != "you must specify topic details" {
177 t.Fatal(err)
178 }
179 err = admin.Close()
180 if err != nil {
181 t.Fatal(err)
182 }
183}
184
185func TestClusterAdminCreateTopicWithoutAuthorization(t *testing.T) {
186 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