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

Function TestClusterAdminIncrementalAlterConfigWithErrorCode

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

Source from the content-addressed store, hash-verified

1439}
1440
1441func TestClusterAdminIncrementalAlterConfigWithErrorCode(t *testing.T) {
1442 seedBroker := NewMockBroker(t, 1)
1443 defer seedBroker.Close()
1444
1445 seedBroker.SetHandlerByMap(map[string]MockResponse{
1446 "MetadataRequest": NewMockMetadataResponse(t).
1447 SetController(seedBroker.BrokerID()).
1448 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()),
1449 "IncrementalAlterConfigsRequest": NewMockIncrementalAlterConfigsResponseWithErrorCode(t),
1450 })
1451
1452 config := NewTestConfig()
1453 config.Version = V2_3_0_0
1454 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
1455 if err != nil {
1456 t.Fatal(err)
1457 }
1458 defer func() {
1459 _ = admin.Close()
1460 }()
1461
1462 var value string
1463 entries := make(map[string]IncrementalAlterConfigsEntry)
1464 value = "60000"
1465 entries["retention.ms"] = IncrementalAlterConfigsEntry{
1466 Operation: IncrementalAlterConfigsOperationSet,
1467 Value: &value,
1468 }
1469 value = "1073741824"
1470 entries["segment.bytes"] = IncrementalAlterConfigsEntry{
1471 Operation: IncrementalAlterConfigsOperationDelete,
1472 Value: &value,
1473 }
1474 err = admin.IncrementalAlterConfig(TopicResource, "my_topic", entries, false)
1475 if err == nil {
1476 t.Fatal(errors.New("ErrorCode present but no Error returned"))
1477 }
1478 if !errors.Is(err, ErrInvalidConfig) {
1479 t.Fatal(errors.New("ErrorCode present but not wrapped into returned error"))
1480 }
1481}
1482
1483func TestClusterAdminIncrementalAlterBrokerConfig(t *testing.T) {
1484 controllerBroker := NewMockBroker(t, 1)

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
SetHandlerByMapMethod · 0.95
BrokerIDMethod · 0.95
AddrMethod · 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