mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 22:07:27 -08:00
Fix TestHeadDeleteSimple to test reloaded Head too (#7021)
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
This commit is contained in:
parent
e64a149984
commit
6fdc852813
|
@ -505,7 +505,6 @@ func TestHeadDeleteSimple(t *testing.T) {
|
||||||
|
|
||||||
for _, compress := range []bool{false, true} {
|
for _, compress := range []bool{false, true} {
|
||||||
t.Run(fmt.Sprintf("compress=%t", compress), func(t *testing.T) {
|
t.Run(fmt.Sprintf("compress=%t", compress), func(t *testing.T) {
|
||||||
Outer:
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
dir, err := ioutil.TempDir("", "test_wal_reload")
|
dir, err := ioutil.TempDir("", "test_wal_reload")
|
||||||
testutil.Ok(t, err)
|
testutil.Ok(t, err)
|
||||||
|
@ -553,22 +552,23 @@ func TestHeadDeleteSimple(t *testing.T) {
|
||||||
testutil.Ok(t, reloadedHead.Init(0))
|
testutil.Ok(t, reloadedHead.Init(0))
|
||||||
|
|
||||||
// Compare the query results for both heads - before and after the reload.
|
// Compare the query results for both heads - before and after the reload.
|
||||||
expSeriesSet := newMockSeriesSet([]storage.Series{
|
Outer:
|
||||||
newSeries(map[string]string{lblDefault.Name: lblDefault.Value}, func() []tsdbutil.Sample {
|
|
||||||
ss := make([]tsdbutil.Sample, 0, len(c.smplsExp))
|
|
||||||
for _, s := range c.smplsExp {
|
|
||||||
ss = append(ss, s)
|
|
||||||
}
|
|
||||||
return ss
|
|
||||||
}(),
|
|
||||||
),
|
|
||||||
})
|
|
||||||
for _, h := range []*Head{head, reloadedHead} {
|
for _, h := range []*Head{head, reloadedHead} {
|
||||||
q, err := NewBlockQuerier(h, h.MinTime(), h.MaxTime())
|
q, err := NewBlockQuerier(h, h.MinTime(), h.MaxTime())
|
||||||
testutil.Ok(t, err)
|
testutil.Ok(t, err)
|
||||||
actSeriesSet, ws, err := q.Select(false, nil, labels.MustNewMatcher(labels.MatchEqual, lblDefault.Name, lblDefault.Value))
|
actSeriesSet, ws, err := q.Select(false, nil, labels.MustNewMatcher(labels.MatchEqual, lblDefault.Name, lblDefault.Value))
|
||||||
testutil.Ok(t, err)
|
testutil.Ok(t, err)
|
||||||
testutil.Equals(t, 0, len(ws))
|
testutil.Equals(t, 0, len(ws))
|
||||||
|
expSeriesSet := newMockSeriesSet([]storage.Series{
|
||||||
|
newSeries(map[string]string{lblDefault.Name: lblDefault.Value}, func() []tsdbutil.Sample {
|
||||||
|
ss := make([]tsdbutil.Sample, 0, len(c.smplsExp))
|
||||||
|
for _, s := range c.smplsExp {
|
||||||
|
ss = append(ss, s)
|
||||||
|
}
|
||||||
|
return ss
|
||||||
|
}(),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
for {
|
for {
|
||||||
eok, rok := expSeriesSet.Next(), actSeriesSet.Next()
|
eok, rok := expSeriesSet.Next(), actSeriesSet.Next()
|
||||||
|
|
Loading…
Reference in a new issue