(b *testing.B)
| 204 | } |
| 205 | |
| 206 | func BenchmarkProduceRequest(b *testing.B) { |
| 207 | t0 := time.Now().Truncate(time.Millisecond) |
| 208 | t1 := t0.Add(1 * time.Millisecond) |
| 209 | t2 := t0.Add(2 * time.Millisecond) |
| 210 | |
| 211 | prototest.BenchmarkRequest(b, v3, &produce.Request{ |
| 212 | TransactionalID: "1234", |
| 213 | Acks: 1, |
| 214 | Timeout: 500, |
| 215 | Topics: []produce.RequestTopic{ |
| 216 | { |
| 217 | Topic: "topic-1", |
| 218 | Partitions: []produce.RequestPartition{ |
| 219 | { |
| 220 | Partition: 0, |
| 221 | RecordSet: protocol.RecordSet{ |
| 222 | Version: 1, |
| 223 | Records: protocol.NewRecordReader( |
| 224 | protocol.Record{Offset: 0, Time: t0, Key: nil, Value: nil}, |
| 225 | ), |
| 226 | }, |
| 227 | }, |
| 228 | { |
| 229 | Partition: 1, |
| 230 | RecordSet: protocol.RecordSet{ |
| 231 | Version: 1, |
| 232 | Records: protocol.NewRecordReader( |
| 233 | protocol.Record{Offset: 0, Time: t0, Key: nil, Value: prototest.String("msg-0")}, |
| 234 | protocol.Record{Offset: 1, Time: t1, Key: nil, Value: prototest.String("msg-1")}, |
| 235 | protocol.Record{Offset: 2, Time: t2, Key: prototest.Bytes([]byte{1}), Value: prototest.String("msg-2")}, |
| 236 | ), |
| 237 | }, |
| 238 | }, |
| 239 | }, |
| 240 | }, |
| 241 | }, |
| 242 | }) |
| 243 | |
| 244 | headers := []protocol.Header{ |
| 245 | {Key: "key-1", Value: []byte("value-1")}, |
| 246 | {Key: "key-2", Value: []byte("value-2")}, |
| 247 | {Key: "key-3", Value: []byte("value-3")}, |
| 248 | } |
| 249 | |
| 250 | prototest.BenchmarkRequest(b, v5, &produce.Request{ |
| 251 | TransactionalID: "1234", |
| 252 | Acks: 1, |
| 253 | Timeout: 500, |
| 254 | Topics: []produce.RequestTopic{ |
| 255 | { |
| 256 | Topic: "topic-1", |
| 257 | Partitions: []produce.RequestPartition{ |
| 258 | { |
| 259 | Partition: 1, |
| 260 | RecordSet: protocol.RecordSet{ |
| 261 | Version: 2, |
| 262 | Records: protocol.NewRecordReader( |
| 263 | protocol.Record{Offset: 0, Time: t0, Key: nil, Value: prototest.String("msg-0"), Headers: headers}, |
nothing calls this directly
no test coverage detected