MCPcopy
hub / github.com/segmentio/kafka-go / TestValidateReader

Function TestValidateReader

reader_test.go:1249–1271  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1247}
1248
1249func TestValidateReader(t *testing.T) {
1250 tests := []struct {
1251 config ReaderConfig
1252 errorOccured bool
1253 }{
1254 {config: ReaderConfig{}, errorOccured: true},
1255 {config: ReaderConfig{Brokers: []string{"broker1"}}, errorOccured: true},
1256 {config: ReaderConfig{Brokers: []string{"broker1"}, Topic: "topic1"}, errorOccured: false},
1257 {config: ReaderConfig{Brokers: []string{"broker1"}, Topic: "topic1", Partition: -1}, errorOccured: true},
1258 {config: ReaderConfig{Brokers: []string{"broker1"}, Topic: "topic1", Partition: 1, MinBytes: -1}, errorOccured: true},
1259 {config: ReaderConfig{Brokers: []string{"broker1"}, Topic: "topic1", Partition: 1, MinBytes: 5, MaxBytes: -1}, errorOccured: true},
1260 {config: ReaderConfig{Brokers: []string{"broker1"}, Topic: "topic1", Partition: 1, MinBytes: 5, MaxBytes: 6}, errorOccured: false},
1261 }
1262 for _, test := range tests {
1263 err := test.config.Validate()
1264 if test.errorOccured && err == nil {
1265 t.Fail()
1266 }
1267 if !test.errorOccured && err != nil {
1268 t.Fail()
1269 }
1270 }
1271}
1272
1273func TestCommitLoopImmediateFlushOnGenerationEnd(t *testing.T) {
1274 t.Parallel()

Callers

nothing calls this directly

Calls 1

ValidateMethod · 0.45

Tested by

no test coverage detected