(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestClientRawProduceCompressed(t *testing.T) { |
| 49 | // The RawProduce request records are encoded in the format introduced in Kafka 0.11.0. |
| 50 | if !ktesting.KafkaIsAtLeast("0.11.0") { |
| 51 | t.Skip("Skipping because the RawProduce request is not supported by Kafka versions below 0.11.0") |
| 52 | } |
| 53 | |
| 54 | client, topic, shutdown := newLocalClientAndTopic() |
| 55 | defer shutdown() |
| 56 | |
| 57 | now := time.Now() |
| 58 | |
| 59 | res, err := client.RawProduce(context.Background(), &RawProduceRequest{ |
| 60 | Topic: topic, |
| 61 | Partition: 0, |
| 62 | RequiredAcks: -1, |
| 63 | RawRecords: NewRawRecordSet(NewRecordReader( |
| 64 | Record{Time: now, Value: NewBytes([]byte(`hello-1`))}, |
| 65 | Record{Time: now, Value: NewBytes([]byte(`hello-2`))}, |
| 66 | Record{Time: now, Value: NewBytes([]byte(`hello-3`))}, |
| 67 | ), protocol.Gzip), |
| 68 | }) |
| 69 | |
| 70 | if err != nil { |
| 71 | t.Fatal(err) |
| 72 | } |
| 73 | |
| 74 | if res.Error != nil { |
| 75 | t.Error(res.Error) |
| 76 | } |
| 77 | |
| 78 | for index, err := range res.RecordErrors { |
| 79 | t.Errorf("record at index %d produced an error: %v", index, err) |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | func TestClientRawProduceNilRecords(t *testing.T) { |
| 84 | client, topic, shutdown := newLocalClientAndTopic() |
nothing calls this directly
no test coverage detected