(t *testing.T)
| 48 | } |
| 49 | |
| 50 | func TestTimeseriesFromPool(t *testing.T) { |
| 51 | t.Run("new instance is provided when not available to reuse", func(t *testing.T) { |
| 52 | first := TimeseriesFromPool() |
| 53 | second := TimeseriesFromPool() |
| 54 | |
| 55 | assert.NotSame(t, first, second) |
| 56 | }) |
| 57 | |
| 58 | t.Run("instance is cleaned before reusing", func(t *testing.T) { |
| 59 | ts := TimeseriesFromPool() |
| 60 | ts.Labels = []LabelAdapter{{Name: "foo", Value: "bar"}} |
| 61 | ts.Samples = []Sample{{Value: 1, TimestampMs: 2}} |
| 62 | ReuseTimeseries(ts) |
| 63 | |
| 64 | reused := TimeseriesFromPool() |
| 65 | assert.Len(t, reused.Labels, 0) |
| 66 | assert.Len(t, reused.Samples, 0) |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | func BenchmarkMarshallWriteRequest(b *testing.B) { |
| 71 | ts := PreallocTimeseriesSliceFromPool() |
nothing calls this directly
no test coverage detected