(t *testing.T, marshalingFormat api.MarshallingFormat)
| 448 | } |
| 449 | |
| 450 | func testCombinerShards(t *testing.T, marshalingFormat api.MarshallingFormat) { |
| 451 | tests := []struct { |
| 452 | name string |
| 453 | pipelineResponse PipelineResponse |
| 454 | expected *tempopb.SearchResponse |
| 455 | }{ |
| 456 | { |
| 457 | name: "initial state", |
| 458 | pipelineResponse: nil, |
| 459 | expected: &tempopb.SearchResponse{ |
| 460 | Traces: []*tempopb.TraceSearchMetadata{}, |
| 461 | Metrics: &tempopb.SearchMetrics{}, |
| 462 | }, |
| 463 | }, |
| 464 | { |
| 465 | name: "add job metadata", |
| 466 | pipelineResponse: &SearchJobResponse{ |
| 467 | JobMetadata: shardtracker.JobMetadata{ |
| 468 | TotalBlocks: 5, |
| 469 | TotalJobs: 6, |
| 470 | TotalBytes: 15, |
| 471 | Shards: []shardtracker.Shard{ // 5 shards, 2 jobs each. starting at 500 seconds and walking back 100 seconds each |
| 472 | { |
| 473 | TotalJobs: 2, |
| 474 | CompletedThroughSeconds: 500, |
| 475 | }, |
| 476 | { |
| 477 | TotalJobs: 1, |
| 478 | CompletedThroughSeconds: 400, |
| 479 | }, |
| 480 | { |
| 481 | TotalJobs: 1, |
| 482 | CompletedThroughSeconds: 300, |
| 483 | }, |
| 484 | { |
| 485 | TotalJobs: 1, |
| 486 | CompletedThroughSeconds: 200, |
| 487 | }, |
| 488 | { |
| 489 | TotalJobs: 1, |
| 490 | CompletedThroughSeconds: 100, |
| 491 | }, |
| 492 | }, |
| 493 | }, |
| 494 | }, |
| 495 | expected: &tempopb.SearchResponse{ |
| 496 | Traces: []*tempopb.TraceSearchMetadata{}, |
| 497 | Metrics: &tempopb.SearchMetrics{ |
| 498 | TotalBlocks: 5, |
| 499 | TotalJobs: 6, |
| 500 | TotalBlockBytes: 15, |
| 501 | }, |
| 502 | }, |
| 503 | }, |
| 504 | { |
| 505 | name: "add response results", |
| 506 | pipelineResponse: toHTTPResponseWithFormat(t, &tempopb.SearchResponse{ |
| 507 | Traces: []*tempopb.TraceSearchMetadata{ |
no test coverage detected