diff --git a/prompb/io/prometheus/write/v2/custom_test.go b/prompb/io/prometheus/write/v2/custom_test.go index 139cbfb225..d565461ec8 100644 --- a/prompb/io/prometheus/write/v2/custom_test.go +++ b/prompb/io/prometheus/write/v2/custom_test.go @@ -30,7 +30,7 @@ func TestOptimizedMarshal(t *testing.T) { { name: "simple", m: &Request{ - Timeseries: []TimeSeries{ + Timeseries: []*TimeSeries{ { LabelsRefs: []uint32{ 0, 1, @@ -43,14 +43,14 @@ func TestOptimizedMarshal(t *testing.T) { 14, 15, }, - Samples: []Sample{{Value: 1, Timestamp: 0}}, - Exemplars: []Exemplar{{LabelsRefs: []uint32{0, 1}, Value: 1, Timestamp: 0}}, + Samples: []*Sample{{Value: 1, Timestamp: 0}}, + Exemplars: []*Exemplar{{LabelsRefs: []uint32{0, 1}, Value: 1, Timestamp: 0}}, Histograms: nil, }, { LabelsRefs: []uint32{ 0, 1, - 2, 3, + 2, 3, 4, 5, 6, 7, 8, 9, @@ -58,8 +58,8 @@ func TestOptimizedMarshal(t *testing.T) { 12, 13, 14, 15, }, - Samples: []Sample{{Value: 2, Timestamp: 1}}, - Exemplars: []Exemplar{{LabelsRefs: []uint32{0, 1}, Value: 2, Timestamp: 1}}, + Samples: []*Sample{{Value: 2, Timestamp: 1}}, + Exemplars: []*Exemplar{{LabelsRefs: []uint32{0, 1}, Value: 2, Timestamp: 1}}, Histograms: nil, }, }, @@ -82,7 +82,7 @@ func TestOptimizedMarshal(t *testing.T) { got := make([]byte, 0) // Should be the same as the standard marshal. - expected, err := tt.m.Marshal() + expected, err := tt.m.MarshalVT() require.NoError(t, err) got, err = tt.m.OptimizedMarshal(got) require.NoError(t, err) @@ -90,7 +90,7 @@ func TestOptimizedMarshal(t *testing.T) { // Unmarshal should work too. m := &Request{} - require.NoError(t, m.Unmarshal(got)) + require.NoError(t, m.UnmarshalVT(got)) require.Equal(t, tt.m, m) }) } diff --git a/prompb/rwcommon/codec_test.go b/prompb/rwcommon/codec_test.go index bafc9bdeec..c76c5c1b4f 100644 --- a/prompb/rwcommon/codec_test.go +++ b/prompb/rwcommon/codec_test.go @@ -128,7 +128,7 @@ func TestToMetadata(t *testing.T) { } { t.Run("", func(t *testing.T) { ts := writev2.TimeSeries{Metadata: tc.input} - require.Equal(t, tc.expected, ts.ToMetadata(sym.Symbols())) + require.Equal(t, *tc.expected, ts.ToMetadata(sym.Symbols())) }) } } @@ -139,8 +139,8 @@ func TestToHistogram_Empty(t *testing.T) { require.NotNilf(t, prompb.Histogram{}.ToFloatHistogram(), "") }) t.Run("v2", func(t *testing.T) { - require.NotNilf(t, writev2.Histogram{}.ToIntHistogram(), "") - require.NotNilf(t, writev2.Histogram{}.ToFloatHistogram(), "") + require.NotNilf(t, (&writev2.Histogram{}).ToIntHistogram(), "") + require.NotNilf(t, (&writev2.Histogram{}).ToFloatHistogram(), "") }) }