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

Function TestClusterAdminDescribeConfigWithErrorCode

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

Source from the content-addressed store, hash-verified

990}
991
992func TestClusterAdminDescribeConfigWithErrorCode(t *testing.T) {
993 seedBroker := NewMockBroker(t, 1)
994 defer seedBroker.Close()
995
996 seedBroker.SetHandlerByMap(map[string]MockResponse{
997 "MetadataRequest": NewMockMetadataResponse(t).
998 SetController(seedBroker.BrokerID()).
999 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()),
1000 "DescribeConfigsRequest": NewMockDescribeConfigsResponseWithErrorCode(t),
1001 })
1002
1003 config := NewTestConfig()
1004 config.Version = V1_1_0_0
1005 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
1006 if err != nil {
1007 t.Fatal(err)
1008 }
1009 defer func() {
1010 _ = admin.Close()
1011 }()
1012
1013 resource := ConfigResource{
1014 Name: "r1",
1015 Type: TopicResource,
1016 ConfigNames: []string{"my_topic"},
1017 }
1018
1019 _, err = admin.DescribeConfig(resource)
1020 if err == nil {
1021 t.Fatal(errors.New("ErrorCode present but no Error returned"))
1022 }
1023}
1024
1025// TestClusterAdminDescribeBrokerConfig ensures that a describe broker config
1026// is sent to the broker in the resource struct, _not_ the controller

Callers

nothing calls this directly

Calls 14

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

Tested by

no test coverage detected