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

Function TestClusterAdminDescribeConfigWithErrorCode

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

Source from the content-addressed store, hash-verified

1195}
1196
1197func TestClusterAdminDescribeConfigWithErrorCode(t *testing.T) {
1198 seedBroker := NewMockBroker(t, 1)
1199 defer seedBroker.Close()
1200
1201 seedBroker.SetHandlerByMap(map[string]MockResponse{
1202 "MetadataRequest": NewMockMetadataResponse(t).
1203 SetController(seedBroker.BrokerID()).
1204 SetBroker(seedBroker.Addr(), seedBroker.BrokerID()),
1205 "DescribeConfigsRequest": NewMockDescribeConfigsResponseWithErrorCode(t),
1206 })
1207
1208 config := NewTestConfig()
1209 config.Version = V1_1_0_0
1210 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
1211 if err != nil {
1212 t.Fatal(err)
1213 }
1214 defer func() {
1215 _ = admin.Close()
1216 }()
1217
1218 resource := ConfigResource{
1219 Name: "r1",
1220 Type: TopicResource,
1221 ConfigNames: []string{"my_topic"},
1222 }
1223
1224 _, err = admin.DescribeConfig(resource)
1225 if err == nil {
1226 t.Fatal(errors.New("ErrorCode present but no Error returned"))
1227 }
1228}
1229
1230// TestClusterAdminDescribeBrokerConfig ensures that a describe broker config
1231// 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