(t *testing.T)
| 521 | } |
| 522 | |
| 523 | func TestBlockListBackendMetrics(t *testing.T) { |
| 524 | tests := []struct { |
| 525 | name string |
| 526 | list PerTenant |
| 527 | compactedList PerTenantCompacted |
| 528 | testType string |
| 529 | expectedBackendObjectsTotal int |
| 530 | expectedBackendBytesTotal uint64 |
| 531 | expectedCompactedBackendObjectsTotal int |
| 532 | expectedCompacteddBackendBytesTotal uint64 |
| 533 | }{ |
| 534 | { |
| 535 | name: "total backend objects calculation is correct", |
| 536 | list: PerTenant{ |
| 537 | "test": []*backend.BlockMeta{ |
| 538 | { |
| 539 | TotalObjects: 10, |
| 540 | }, |
| 541 | { |
| 542 | TotalObjects: 7, |
| 543 | }, |
| 544 | { |
| 545 | TotalObjects: 8, |
| 546 | }, |
| 547 | }, |
| 548 | }, |
| 549 | compactedList: PerTenantCompacted{ |
| 550 | "test": []*backend.CompactedBlockMeta{ |
| 551 | { |
| 552 | BlockMeta: backend.BlockMeta{ |
| 553 | TotalObjects: 7, |
| 554 | }, |
| 555 | }, |
| 556 | { |
| 557 | BlockMeta: backend.BlockMeta{ |
| 558 | TotalObjects: 8, |
| 559 | }, |
| 560 | }, |
| 561 | { |
| 562 | BlockMeta: backend.BlockMeta{ |
| 563 | TotalObjects: 5, |
| 564 | }, |
| 565 | }, |
| 566 | { |
| 567 | BlockMeta: backend.BlockMeta{ |
| 568 | TotalObjects: 15, |
| 569 | }, |
| 570 | }, |
| 571 | }, |
| 572 | }, |
| 573 | expectedBackendObjectsTotal: 25, |
| 574 | expectedBackendBytesTotal: 0, |
| 575 | expectedCompactedBackendObjectsTotal: 35, |
| 576 | expectedCompacteddBackendBytesTotal: 0, |
| 577 | testType: "backend objects", |
| 578 | }, |
| 579 | { |
| 580 | name: "total backend bytes calculation is correct", |
nothing calls this directly
no test coverage detected