mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
WIP
This commit is contained in:
parent
ff4fceeda6
commit
ad20b23cf1
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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(), "")
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue