This commit is contained in:
Junang Li 2024-09-14 11:00:56 -04:00
parent ff4fceeda6
commit ad20b23cf1
2 changed files with 11 additions and 11 deletions

View file

@ -30,7 +30,7 @@ func TestOptimizedMarshal(t *testing.T) {
{
name: "simple",
m: &Request{
Timeseries: []TimeSeries{
Timeseries: []*TimeSeries{
{
LabelsRefs: []uint32{
0, 1,
@ -43,8 +43,8 @@ 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,
},
{
@ -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)
})
}

View file

@ -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(), "")
})
}