Merge pull request #323 from AlekSi/small-fixes

Small fixes
This commit is contained in:
Goutham Veeramachaneni 2018-05-07 16:15:44 +02:00 committed by GitHub
commit 24a9f278d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 23 deletions

View file

@ -89,7 +89,7 @@ func TestDataAvailableOnlyAfterCommit(t *testing.T) {
seriesSet = query(t, querier, labels.NewEqualMatcher("foo", "bar")) seriesSet = query(t, querier, labels.NewEqualMatcher("foo", "bar"))
testutil.Equals(t, seriesSet, map[string][]sample{`{foo="bar"}`: []sample{{t: 0, v: 0}}}) testutil.Equals(t, seriesSet, map[string][]sample{`{foo="bar"}`: {{t: 0, v: 0}}})
} }
func TestDataNotAvailableAfterRollback(t *testing.T) { func TestDataNotAvailableAfterRollback(t *testing.T) {
@ -156,7 +156,7 @@ func TestDBAppenderAddRef(t *testing.T) {
res := query(t, q, labels.NewEqualMatcher("a", "b")) res := query(t, q, labels.NewEqualMatcher("a", "b"))
testutil.Equals(t, map[string][]sample{ testutil.Equals(t, map[string][]sample{
labels.FromStrings("a", "b").String(): []sample{ labels.FromStrings("a", "b").String(): {
{t: 123, v: 0}, {t: 123, v: 0},
{t: 124, v: 1}, {t: 124, v: 1},
{t: 125, v: 0}, {t: 125, v: 0},
@ -310,7 +310,7 @@ func TestSkippingInvalidValuesInSameTxn(t *testing.T) {
ssMap := query(t, q, labels.NewEqualMatcher("a", "b")) ssMap := query(t, q, labels.NewEqualMatcher("a", "b"))
testutil.Equals(t, map[string][]sample{ testutil.Equals(t, map[string][]sample{
labels.New(labels.Label{"a", "b"}).String(): []sample{{0, 1}}, labels.New(labels.Label{"a", "b"}).String(): {{0, 1}},
}, ssMap) }, ssMap)
testutil.Ok(t, q.Close()) testutil.Ok(t, q.Close())
@ -329,7 +329,7 @@ func TestSkippingInvalidValuesInSameTxn(t *testing.T) {
ssMap = query(t, q, labels.NewEqualMatcher("a", "b")) ssMap = query(t, q, labels.NewEqualMatcher("a", "b"))
testutil.Equals(t, map[string][]sample{ testutil.Equals(t, map[string][]sample{
labels.New(labels.Label{"a", "b"}).String(): []sample{{0, 1}, {10, 3}}, labels.New(labels.Label{"a", "b"}).String(): {{0, 1}, {10, 3}},
}, ssMap) }, ssMap)
testutil.Ok(t, q.Close()) testutil.Ok(t, q.Close())
} }

View file

@ -179,17 +179,17 @@ func TestHead_Truncate(t *testing.T) {
testutil.Assert(t, postingsC1 == nil, "") testutil.Assert(t, postingsC1 == nil, "")
testutil.Equals(t, map[string]struct{}{ testutil.Equals(t, map[string]struct{}{
"": struct{}{}, // from 'all' postings list "": {}, // from 'all' postings list
"a": struct{}{}, "a": {},
"b": struct{}{}, "b": {},
"1": struct{}{}, "1": {},
"2": struct{}{}, "2": {},
}, h.symbols) }, h.symbols)
testutil.Equals(t, map[string]stringset{ testutil.Equals(t, map[string]stringset{
"a": stringset{"1": struct{}{}, "2": struct{}{}}, "a": {"1": struct{}{}, "2": struct{}{}},
"b": stringset{"1": struct{}{}}, "b": {"1": struct{}{}},
"": stringset{"": struct{}{}}, "": {"": struct{}{}},
}, h.values) }, h.values)
} }

View file

@ -192,12 +192,12 @@ func TestIndexRW_Postings(t *testing.T) {
} }
err = iw.AddSymbols(map[string]struct{}{ err = iw.AddSymbols(map[string]struct{}{
"a": struct{}{}, "a": {},
"b": struct{}{}, "b": {},
"1": struct{}{}, "1": {},
"2": struct{}{}, "2": {},
"3": struct{}{}, "3": {},
"4": struct{}{}, "4": {},
}) })
testutil.Ok(t, err) testutil.Ok(t, err)

6
wal.go
View file

@ -937,7 +937,7 @@ func (r *walReader) Read(
series = v.([]RefSeries) series = v.([]RefSeries)
} }
err := r.decodeSeries(flag, b, &series) err = r.decodeSeries(flag, b, &series)
if err != nil { if err != nil {
err = errors.Wrap(err, "decode series entry") err = errors.Wrap(err, "decode series entry")
break break
@ -958,7 +958,7 @@ func (r *walReader) Read(
samples = v.([]RefSample) samples = v.([]RefSample)
} }
err := r.decodeSamples(flag, b, &samples) err = r.decodeSamples(flag, b, &samples)
if err != nil { if err != nil {
err = errors.Wrap(err, "decode samples entry") err = errors.Wrap(err, "decode samples entry")
break break
@ -980,7 +980,7 @@ func (r *walReader) Read(
deletes = v.([]Stone) deletes = v.([]Stone)
} }
err := r.decodeDeletes(flag, b, &deletes) err = r.decodeDeletes(flag, b, &deletes)
if err != nil { if err != nil {
err = errors.Wrap(err, "decode delete entry") err = errors.Wrap(err, "decode delete entry")
break break