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

Function TestValidateWriter

writer_test.go:310–328  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

308}
309
310func TestValidateWriter(t *testing.T) {
311 tests := []struct {
312 config WriterConfig
313 errorOccured bool
314 }{
315 {config: WriterConfig{}, errorOccured: true},
316 {config: WriterConfig{Brokers: []string{"broker1", "broker2"}}, errorOccured: false},
317 {config: WriterConfig{Brokers: []string{"broker1"}, Topic: "topic1"}, errorOccured: false},
318 }
319 for _, test := range tests {
320 err := test.config.Validate()
321 if test.errorOccured && err == nil {
322 t.Fail()
323 }
324 if !test.errorOccured && err != nil {
325 t.Fail()
326 }
327 }
328}
329
330func testWriterMaxAttemptsErr(t *testing.T) {
331 topic := makeTopic()

Callers

nothing calls this directly

Calls 1

ValidateMethod · 0.45

Tested by

no test coverage detected