mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
tsdb tests: use go-cmp instead of DeepEquals
Also one simpler call checking nil. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
17f48f2b3b
commit
12cac5bd5c
|
@ -679,10 +679,10 @@ func TestHead_ReadWAL(t *testing.T) {
|
|||
s50 := head.series.getByID(50)
|
||||
s100 := head.series.getByID(100)
|
||||
|
||||
require.Equal(t, labels.FromStrings("a", "1"), s10.lset)
|
||||
require.Equal(t, (*memSeries)(nil), s11) // Series without samples should be garbage collected at head.Init().
|
||||
require.Equal(t, labels.FromStrings("a", "4"), s50.lset)
|
||||
require.Equal(t, labels.FromStrings("a", "3"), s100.lset)
|
||||
testutil.RequireEqual(t, labels.FromStrings("a", "1"), s10.lset)
|
||||
require.Nil(t, s11) // Series without samples should be garbage collected at head.Init().
|
||||
testutil.RequireEqual(t, labels.FromStrings("a", "4"), s50.lset)
|
||||
testutil.RequireEqual(t, labels.FromStrings("a", "3"), s100.lset)
|
||||
|
||||
expandChunk := func(c chunkenc.Iterator) (x []sample) {
|
||||
for c.Next() == chunkenc.ValFloat {
|
||||
|
@ -709,7 +709,7 @@ func TestHead_ReadWAL(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
e, err := q.Select(0, 1000, []*labels.Matcher{labels.MustNewMatcher(labels.MatchEqual, "a", "1")})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, exemplar.Exemplar{Ts: 100, Value: 1, Labels: labels.FromStrings("traceID", "asdf")}, e[0].Exemplars[0])
|
||||
require.True(t, exemplar.Exemplar{Ts: 100, Value: 1, Labels: labels.FromStrings("traceID", "asdf")}.Equals(e[0].Exemplars[0]))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/prometheus/prometheus/tsdb/chunks"
|
||||
"github.com/prometheus/prometheus/tsdb/fileutil"
|
||||
"github.com/prometheus/prometheus/tsdb/index"
|
||||
"github.com/prometheus/prometheus/util/testutil"
|
||||
)
|
||||
|
||||
func TestRepairBadIndexVersion(t *testing.T) {
|
||||
|
@ -112,7 +113,7 @@ func TestRepairBadIndexVersion(t *testing.T) {
|
|||
}
|
||||
|
||||
require.NoError(t, p.Err())
|
||||
require.Equal(t, []labels.Labels{
|
||||
testutil.RequireEqual(t, []labels.Labels{
|
||||
labels.FromStrings("a", "1", "b", "1"),
|
||||
labels.FromStrings("a", "2", "b", "1"),
|
||||
}, res)
|
||||
|
|
Loading…
Reference in a new issue