Fix failing tests

Signed-off-by: Annanay <annanayagarwal@gmail.com>
This commit is contained in:
Annanay 2020-07-30 17:06:56 +05:30
parent 9bba8a6eae
commit 263d2aa5f5
3 changed files with 5 additions and 4 deletions

View File

@ -878,7 +878,7 @@ func BenchmarkCompactionFromHead(b *testing.B) {
h, err := NewHead(nil, nil, nil, 1000, chunkDir, nil, DefaultStripeSize, nil) h, err := NewHead(nil, nil, nil, 1000, chunkDir, nil, DefaultStripeSize, nil)
testutil.Ok(b, err) testutil.Ok(b, err)
for ln := 0; ln < labelNames; ln++ { for ln := 0; ln < labelNames; ln++ {
app := h.Appender() app := h.Appender(context.Background())
for lv := 0; lv < labelValues; lv++ { for lv := 0; lv < labelValues; lv++ {
app.Add(labels.FromStrings(fmt.Sprintf("%d", ln), fmt.Sprintf("%d%s%d", lv, postingsBenchSuffix, ln)), 0, 0) app.Add(labels.FromStrings(fmt.Sprintf("%d", ln), fmt.Sprintf("%d%s%d", lv, postingsBenchSuffix, ln)), 0, 0)
} }

View File

@ -14,6 +14,7 @@
package tsdb package tsdb
import ( import (
"context"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
@ -41,7 +42,7 @@ func BenchmarkPostingsForMatchers(b *testing.B) {
testutil.Ok(b, h.Close()) testutil.Ok(b, h.Close())
}() }()
app := h.Appender() app := h.Appender(context.Background())
addSeries := func(l labels.Labels) { addSeries := func(l labels.Labels) {
app.Add(l, 0, 0) app.Add(l, 0, 0)
} }
@ -147,7 +148,7 @@ func BenchmarkQuerierSelect(b *testing.B) {
h, err := NewHead(nil, nil, nil, 1000, chunkDir, nil, DefaultStripeSize, nil) h, err := NewHead(nil, nil, nil, 1000, chunkDir, nil, DefaultStripeSize, nil)
testutil.Ok(b, err) testutil.Ok(b, err)
defer h.Close() defer h.Close()
app := h.Appender() app := h.Appender(context.Background())
numSeries := 1000000 numSeries := 1000000
for i := 0; i < numSeries; i++ { for i := 0; i < numSeries; i++ {
app.Add(labels.FromStrings("foo", "bar", "i", fmt.Sprintf("%d%s", i, postingsBenchSuffix)), int64(i), 0) app.Add(labels.FromStrings("foo", "bar", "i", fmt.Sprintf("%d%s", i, postingsBenchSuffix)), int64(i), 0)

View File

@ -1875,7 +1875,7 @@ func TestPostingsForMatchers(t *testing.T) {
testutil.Ok(t, h.Close()) testutil.Ok(t, h.Close())
}() }()
app := h.Appender() app := h.Appender(context.Background())
app.Add(labels.FromStrings("n", "1"), 0, 0) app.Add(labels.FromStrings("n", "1"), 0, 0)
app.Add(labels.FromStrings("n", "1", "i", "a"), 0, 0) app.Add(labels.FromStrings("n", "1", "i", "a"), 0, 0)
app.Add(labels.FromStrings("n", "1", "i", "b"), 0, 0) app.Add(labels.FromStrings("n", "1", "i", "b"), 0, 0)