(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestCombineProtoTotals(t *testing.T) { |
| 20 | methods := []func(a, b *tempopb.Trace) (*tempopb.Trace, int){ |
| 21 | func(a, b *tempopb.Trace) (*tempopb.Trace, int) { |
| 22 | c := NewCombiner(0, false) |
| 23 | _, err := c.Consume(a) |
| 24 | require.NoError(t, err) |
| 25 | _, err = c.Consume(b) |
| 26 | require.NoError(t, err) |
| 27 | return c.Result() |
| 28 | }, |
| 29 | } |
| 30 | |
| 31 | sameTrace := test.MakeTraceWithSpanCount(10, 10, []byte{0x01, 0x03}) |
| 32 | tests := []struct { |
| 33 | traceA *tempopb.Trace |
| 34 | traceB *tempopb.Trace |
| 35 | expectedTotal int |
| 36 | }{ |
| 37 | { |
| 38 | traceA: nil, |
| 39 | traceB: test.MakeTraceWithSpanCount(10, 10, []byte{0x01, 0x03}), |
| 40 | expectedTotal: -1, |
| 41 | }, |
| 42 | { |
| 43 | traceA: test.MakeTraceWithSpanCount(10, 10, []byte{0x01, 0x03}), |
| 44 | traceB: nil, |
| 45 | expectedTotal: -1, |
| 46 | }, |
| 47 | { |
| 48 | traceA: test.MakeTraceWithSpanCount(10, 10, []byte{0x01, 0x03}), |
| 49 | traceB: test.MakeTraceWithSpanCount(10, 10, []byte{0x01, 0x01}), |
| 50 | expectedTotal: 200, |
| 51 | }, |
| 52 | { |
| 53 | traceA: sameTrace, |
| 54 | traceB: sameTrace, |
| 55 | expectedTotal: 100, |
| 56 | }, |
| 57 | } |
| 58 | |
| 59 | for _, tt := range tests { |
| 60 | for _, m := range methods { |
| 61 | _, actualTotal := m(tt.traceA, tt.traceB) |
| 62 | assert.Equal(t, tt.expectedTotal, actualTotal) |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | func TestCombinerChecksMaxBytes(t *testing.T) { |
| 68 | // Ensure that the combiner checks max bytes when consuming a trace. |
nothing calls this directly
no test coverage detected