(t *testing.T)
| 468 | } |
| 469 | |
| 470 | func TestConsumerConfigValidates(t *testing.T) { |
| 471 | tests := []struct { |
| 472 | name string |
| 473 | cfg func(*Config) |
| 474 | err string |
| 475 | }{ |
| 476 | { |
| 477 | "ReadCommitted Version", |
| 478 | func(cfg *Config) { |
| 479 | cfg.Version = V0_10_0_0 |
| 480 | cfg.Consumer.IsolationLevel = ReadCommitted |
| 481 | }, |
| 482 | "ReadCommitted requires Version >= V0_11_0_0", |
| 483 | }, |
| 484 | { |
| 485 | "Incorrect isolation level", |
| 486 | func(cfg *Config) { |
| 487 | cfg.Version = V0_11_0_0 |
| 488 | cfg.Consumer.IsolationLevel = IsolationLevel(42) |
| 489 | }, |
| 490 | "Consumer.IsolationLevel must be ReadUncommitted or ReadCommitted", |
| 491 | }, |
| 492 | } |
| 493 | |
| 494 | for i, test := range tests { |
| 495 | c := NewTestConfig() |
| 496 | test.cfg(c) |
| 497 | err := c.Validate() |
| 498 | var target ConfigurationError |
| 499 | if !errors.As(err, &target) || string(target) != test.err { |
| 500 | t.Errorf("[%d]:[%s] Expected %s, Got %s\n", i, test.name, test.err, err) |
| 501 | } |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | func TestLZ4ConfigValidation(t *testing.T) { |
| 506 | config := NewTestConfig() |
nothing calls this directly
no test coverage detected