(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestClientProduceCompressed(t *testing.T) { |
| 75 | client, topic, shutdown := newLocalClientAndTopic() |
| 76 | defer shutdown() |
| 77 | |
| 78 | now := time.Now() |
| 79 | |
| 80 | res, err := client.Produce(context.Background(), &ProduceRequest{ |
| 81 | Topic: topic, |
| 82 | Partition: 0, |
| 83 | RequiredAcks: -1, |
| 84 | Compression: compress.Gzip, |
| 85 | Records: NewRecordReader( |
| 86 | Record{Time: now, Value: NewBytes([]byte(`hello-1`))}, |
| 87 | Record{Time: now, Value: NewBytes([]byte(`hello-2`))}, |
| 88 | Record{Time: now, Value: NewBytes([]byte(`hello-3`))}, |
| 89 | ), |
| 90 | }) |
| 91 | |
| 92 | if err != nil { |
| 93 | t.Fatal(err) |
| 94 | } |
| 95 | |
| 96 | if res.Error != nil { |
| 97 | t.Error(res.Error) |
| 98 | } |
| 99 | |
| 100 | for index, err := range res.RecordErrors { |
| 101 | t.Errorf("record at index %d produced an error: %v", index, err) |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | func TestClientProduceNilRecords(t *testing.T) { |
| 106 | client, topic, shutdown := newLocalClientAndTopic() |
nothing calls this directly
no test coverage detected