(t *testing.T)
| 707 | } |
| 708 | |
| 709 | func TestSearchCombinerPadTraceIDs(t *testing.T) { |
| 710 | tests := []struct { |
| 711 | name string |
| 712 | padTraceIDs bool |
| 713 | marshalingFmt api.MarshallingFormat |
| 714 | inputTraceIDs []string |
| 715 | expectedIDs []string |
| 716 | useDiff bool |
| 717 | }{ |
| 718 | { |
| 719 | name: "padding enabled with JSON format", |
| 720 | padTraceIDs: true, |
| 721 | marshalingFmt: api.MarshallingFormatJSON, |
| 722 | inputTraceIDs: []string{"8efff798038103d269b633813fc703"}, |
| 723 | expectedIDs: []string{"008efff798038103d269b633813fc703"}, |
| 724 | }, |
| 725 | { |
| 726 | name: "padding enabled with JSON format - 64-bit trace ID", |
| 727 | padTraceIDs: true, |
| 728 | marshalingFmt: api.MarshallingFormatJSON, |
| 729 | inputTraceIDs: []string{"1234567890abcdef"}, |
| 730 | expectedIDs: []string{"00000000000000001234567890abcdef"}, |
| 731 | }, |
| 732 | { |
| 733 | name: "padding disabled with JSON format", |
| 734 | padTraceIDs: false, |
| 735 | marshalingFmt: api.MarshallingFormatJSON, |
| 736 | inputTraceIDs: []string{"8efff798038103d269b633813fc703"}, |
| 737 | expectedIDs: []string{"8efff798038103d269b633813fc703"}, |
| 738 | }, |
| 739 | { |
| 740 | name: "padding enabled with protobuf format", |
| 741 | padTraceIDs: true, |
| 742 | marshalingFmt: api.MarshallingFormatProtobuf, |
| 743 | inputTraceIDs: []string{"8efff798038103d269b633813fc703"}, |
| 744 | expectedIDs: []string{"008efff798038103d269b633813fc703"}, |
| 745 | }, |
| 746 | { |
| 747 | name: "padding enabled - already 32 chars", |
| 748 | padTraceIDs: true, |
| 749 | marshalingFmt: api.MarshallingFormatJSON, |
| 750 | inputTraceIDs: []string{"1234567890abcdef1234567890abcdef"}, |
| 751 | expectedIDs: []string{"1234567890abcdef1234567890abcdef"}, |
| 752 | }, |
| 753 | { |
| 754 | name: "padding enabled via diff", |
| 755 | padTraceIDs: true, |
| 756 | marshalingFmt: api.MarshallingFormatJSON, |
| 757 | inputTraceIDs: []string{"8efff798038103d269b633813fc703"}, |
| 758 | expectedIDs: []string{"008efff798038103d269b633813fc703"}, |
| 759 | useDiff: true, |
| 760 | }, |
| 761 | } |
| 762 | |
| 763 | for _, tc := range tests { |
| 764 | t.Run(tc.name, func(t *testing.T) { |
| 765 | traces := make([]*tempopb.TraceSearchMetadata, 0, len(tc.inputTraceIDs)) |
| 766 | for _, id := range tc.inputTraceIDs { |
nothing calls this directly
no test coverage detected