tsdb tests: make work with labels SymbolTable

Need to initialize decoders with SymbolTable.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2023-04-16 23:13:47 +02:00
parent 93b72ec5dd
commit 925134e6de
6 changed files with 10 additions and 10 deletions

View file

@ -184,7 +184,7 @@ func TestCommit(t *testing.T) {
// Read records from WAL and check for expected count of series, samples, and exemplars. // Read records from WAL and check for expected count of series, samples, and exemplars.
var ( var (
r = wlog.NewReader(sr) r = wlog.NewReader(sr)
dec record.Decoder dec = record.NewDecoder(labels.NewSymbolTable())
walSeriesCount, walSamplesCount, walExemplarsCount, walHistogramCount, walFloatHistogramCount int walSeriesCount, walSamplesCount, walExemplarsCount, walHistogramCount, walFloatHistogramCount int
) )
@ -293,7 +293,7 @@ func TestRollback(t *testing.T) {
// Read records from WAL and check for expected count of series and samples. // Read records from WAL and check for expected count of series and samples.
var ( var (
r = wlog.NewReader(sr) r = wlog.NewReader(sr)
dec record.Decoder dec = record.NewDecoder(labels.NewSymbolTable())
walSeriesCount, walSamplesCount, walHistogramCount, walFloatHistogramCount, walExemplarsCount int walSeriesCount, walSamplesCount, walHistogramCount, walFloatHistogramCount, walExemplarsCount int
) )
@ -737,7 +737,7 @@ func TestStorage_DuplicateExemplarsIgnored(t *testing.T) {
defer sr.Close() defer sr.Close()
r := wlog.NewReader(sr) r := wlog.NewReader(sr)
var dec record.Decoder dec := record.NewDecoder(labels.NewSymbolTable())
for r.Next() { for r.Next() {
rec := r.Record() rec := r.Record()
if dec.Type(rec) == record.Exemplars { if dec.Type(rec) == record.Exemplars {

View file

@ -4031,7 +4031,7 @@ func TestOOOWALWrite(t *testing.T) {
var ( var (
records []interface{} records []interface{}
dec record.Decoder dec record.Decoder = record.NewDecoder(labels.NewSymbolTable())
) )
for r.Next() { for r.Next() {
rec := r.Record() rec := r.Record()
@ -5390,7 +5390,7 @@ func TestWBLAndMmapReplay(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
sr, err := wlog.NewSegmentsReader(originalWblDir) sr, err := wlog.NewSegmentsReader(originalWblDir)
require.NoError(t, err) require.NoError(t, err)
var dec record.Decoder dec := record.NewDecoder(labels.NewSymbolTable())
r, markers, addedRecs := wlog.NewReader(sr), 0, 0 r, markers, addedRecs := wlog.NewReader(sr), 0, 0
for r.Next() { for r.Next() {
rec := r.Record() rec := r.Record()

View file

@ -172,7 +172,7 @@ func readTestWAL(t testing.TB, dir string) (recs []interface{}) {
require.NoError(t, sr.Close()) require.NoError(t, sr.Close())
}() }()
var dec record.Decoder dec := record.NewDecoder(labels.NewSymbolTable())
r := wlog.NewReader(sr) r := wlog.NewReader(sr)
for r.Next() { for r.Next() {

View file

@ -29,7 +29,7 @@ import (
func TestRecord_EncodeDecode(t *testing.T) { func TestRecord_EncodeDecode(t *testing.T) {
var enc Encoder var enc Encoder
var dec Decoder dec := NewDecoder(labels.NewSymbolTable())
series := []RefSeries{ series := []RefSeries{
{ {
@ -187,7 +187,7 @@ func TestRecord_EncodeDecode(t *testing.T) {
// Bugfix check for pull/521 and pull/523. // Bugfix check for pull/521 and pull/523.
func TestRecord_Corrupted(t *testing.T) { func TestRecord_Corrupted(t *testing.T) {
var enc Encoder var enc Encoder
var dec Decoder dec := NewDecoder(labels.NewSymbolTable())
t.Run("Test corrupted series record", func(t *testing.T) { t.Run("Test corrupted series record", func(t *testing.T) {
series := []RefSeries{ series := []RefSeries{

View file

@ -510,7 +510,7 @@ func TestMigrateWAL_Fuzz(t *testing.T) {
r := wlog.NewReader(sr) r := wlog.NewReader(sr)
var res []interface{} var res []interface{}
var dec record.Decoder dec := record.NewDecoder(labels.NewSymbolTable())
for r.Next() { for r.Next() {
rec := r.Record() rec := r.Record()

View file

@ -237,7 +237,7 @@ func TestCheckpoint(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
defer sr.Close() defer sr.Close()
var dec record.Decoder dec := record.NewDecoder(labels.NewSymbolTable())
var series []record.RefSeries var series []record.RefSeries
var metadata []record.RefMetadata var metadata []record.RefMetadata
r := NewReader(sr) r := NewReader(sr)