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

Function TestClusterAdminAlterConfigWithErrorCode

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

Source from the content-addressed store, hash-verified

1313}
1314
1315func TestClusterAdminAlterConfigWithErrorCode(t *testing.T) {
1316 seedBroker := NewMockBroker(t, 1)
1317 defer seedBroker.Close()
1318
1319 seedBroker.SetHandlerByMap(map[string]MockResponse{
1320 "MetadataRequest": NewMockMetadataResponse(t).
1321 SetController(seedBroker.BrokerID()).
1322 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()),
1323 "AlterConfigsRequest": NewMockAlterConfigsResponseWithErrorCode(t),
1324 })
1325
1326 config := NewTestConfig()
1327 config.Version = V1_0_0_0
1328 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
1329 if err != nil {
1330 t.Fatal(err)
1331 }
1332 defer func() {
1333 _ = admin.Close()
1334 }()
1335
1336 var value string
1337 entries := make(map[string]*string)
1338 value = "60000"
1339 entries["retention.ms"] = &value
1340 err = admin.AlterConfig(TopicResource, "my_topic", entries, false)
1341 if err == nil {
1342 t.Fatal(errors.New("ErrorCode present but no Error returned"))
1343 }
1344}
1345
1346func TestClusterAdminAlterBrokerConfig(t *testing.T) {
1347 controllerBroker := NewMockBroker(t, 1)

Callers

nothing calls this directly

Calls 14

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

Tested by

no test coverage detected