(t *testing.T)
| 187 | } |
| 188 | |
| 189 | func TestProducerWithCheckerFunction(t *testing.T) { |
| 190 | trm := newTestReporterMock() |
| 191 | mp := NewAsyncProducer(trm, nil). |
| 192 | ExpectInputWithCheckerFunctionAndSucceed(generateRegexpChecker("^tes")). |
| 193 | ExpectInputWithCheckerFunctionAndSucceed(generateRegexpChecker("^tes$")) |
| 194 | |
| 195 | mp.Input() <- &sarama.ProducerMessage{Topic: "test", Value: sarama.StringEncoder("test")} |
| 196 | mp.Input() <- &sarama.ProducerMessage{Topic: "test", Value: sarama.StringEncoder("test")} |
| 197 | if err := mp.Close(); err != nil { |
| 198 | t.Error(err) |
| 199 | } |
| 200 | |
| 201 | if len(mp.Errors()) != 1 { |
| 202 | t.Error("Expected to report an error") |
| 203 | } |
| 204 | |
| 205 | err1 := <-mp.Errors() |
| 206 | if !strings.HasPrefix(err1.Err.Error(), "No match") { |
| 207 | t.Error("Expected to report a value check error, found: ", err1.Err) |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | func TestProducerWithBrokenPartitioner(t *testing.T) { |
| 212 | trm := newTestReporterMock() |
nothing calls this directly
no test coverage detected