Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/storage/stores/tsdb/util_test.go

32 lines
628 B

package tsdb
import (
"context"
"testing"
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
type LoadableSeries struct {
Labels labels.Labels
Chunks index.ChunkMetas
}
func BuildIndex(t *testing.T, dir, tenant string, cases []LoadableSeries) *TSDBIndex {
b := index.NewBuilder()
for _, s := range cases {
b.AddSeries(s.Labels, s.Chunks)
}
dst, err := b.Build(context.Background(), dir, tenant)
require.Nil(t, err)
location := dst.FilePath(dir)
idx, err := LoadTSDB(location)
require.Nil(t, err)
return idx
}