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

Function TestAdminConfigValidates

config_test.go:313–337  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

311}
312
313func TestAdminConfigValidates(t *testing.T) {
314 tests := []struct {
315 name string
316 cfg func(*Config) // resorting to using a function as a param because of internal composite structs
317 err string
318 }{
319 {
320 "Timeout",
321 func(cfg *Config) {
322 cfg.Admin.Timeout = 0
323 },
324 "Admin.Timeout must be > 0",
325 },
326 }
327
328 for i, test := range tests {
329 c := NewTestConfig()
330 test.cfg(c)
331 err := c.Validate()
332 var target ConfigurationError
333 if !errors.As(err, &target) || string(target) != test.err {
334 t.Errorf("[%d]:[%s] Expected %s, Got %s\n", i, test.name, test.err, err)
335 }
336 }
337}
338
339func TestProducerConfigValidates(t *testing.T) {
340 tests := []struct {

Callers

nothing calls this directly

Calls 3

ValidateMethod · 0.80
NewTestConfigFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected