(b *testing.B)
| 141 | } |
| 142 | |
| 143 | func BenchmarkProduceRequest(b *testing.B) { |
| 144 | t0 := time.Now().Truncate(time.Millisecond) |
| 145 | t1 := t0.Add(1 * time.Millisecond) |
| 146 | t2 := t0.Add(2 * time.Millisecond) |
| 147 | |
| 148 | prototest.BenchmarkRequest(b, v3, &rawproduce.Request{ |
| 149 | TransactionalID: "1234", |
| 150 | Acks: 1, |
| 151 | Timeout: 500, |
| 152 | Topics: []rawproduce.RequestTopic{ |
| 153 | { |
| 154 | Topic: "topic-1", |
| 155 | Partitions: []rawproduce.RequestPartition{ |
| 156 | { |
| 157 | Partition: 0, |
| 158 | RecordSet: NewRawRecordSet(protocol.NewRecordReader( |
| 159 | protocol.Record{Offset: 0, Time: t0, Key: nil, Value: nil}, |
| 160 | ), 1, 0), |
| 161 | }, |
| 162 | { |
| 163 | Partition: 1, |
| 164 | RecordSet: NewRawRecordSet(protocol.NewRecordReader( |
| 165 | protocol.Record{Offset: 0, Time: t0, Key: nil, Value: prototest.String("msg-0")}, |
| 166 | protocol.Record{Offset: 1, Time: t1, Key: nil, Value: prototest.String("msg-1")}, |
| 167 | protocol.Record{Offset: 2, Time: t2, Key: prototest.Bytes([]byte{1}), Value: prototest.String("msg-2")}, |
| 168 | ), 1, 0), |
| 169 | }, |
| 170 | }, |
| 171 | }, |
| 172 | }, |
| 173 | }) |
| 174 | |
| 175 | headers := []protocol.Header{ |
| 176 | {Key: "key-1", Value: []byte("value-1")}, |
| 177 | {Key: "key-2", Value: []byte("value-2")}, |
| 178 | {Key: "key-3", Value: []byte("value-3")}, |
| 179 | } |
| 180 | |
| 181 | prototest.BenchmarkRequest(b, v5, &rawproduce.Request{ |
| 182 | TransactionalID: "1234", |
| 183 | Acks: 1, |
| 184 | Timeout: 500, |
| 185 | Topics: []rawproduce.RequestTopic{ |
| 186 | { |
| 187 | Topic: "topic-1", |
| 188 | Partitions: []rawproduce.RequestPartition{ |
| 189 | { |
| 190 | Partition: 1, |
| 191 | RecordSet: NewRawRecordSet(protocol.NewRecordReader( |
| 192 | protocol.Record{Offset: 0, Time: t0, Key: nil, Value: prototest.String("msg-0"), Headers: headers}, |
| 193 | protocol.Record{Offset: 1, Time: t1, Key: nil, Value: prototest.String("msg-1")}, |
| 194 | protocol.Record{Offset: 2, Time: t2, Key: prototest.Bytes([]byte{1}), Value: prototest.String("msg-2")}, |
| 195 | ), 2, 0), |
| 196 | }, |
| 197 | }, |
| 198 | }, |
| 199 | }, |
| 200 | }) |
nothing calls this directly
no test coverage detected