Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Small fixes #323

Merged
merged 2 commits into from
May 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestDataAvailableOnlyAfterCommit(t *testing.T) {

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) {
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestDBAppenderAddRef(t *testing.T) {
res := query(t, q, labels.NewEqualMatcher("a", "b"))

testutil.Equals(t, map[string][]sample{
labels.FromStrings("a", "b").String(): []sample{
labels.FromStrings("a", "b").String(): {
{t: 123, v: 0},
{t: 124, v: 1},
{t: 125, v: 0},
Expand Down Expand Up @@ -310,7 +310,7 @@ func TestSkippingInvalidValuesInSameTxn(t *testing.T) {
ssMap := query(t, q, labels.NewEqualMatcher("a", "b"))

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)

testutil.Ok(t, q.Close())
Expand All @@ -329,7 +329,7 @@ func TestSkippingInvalidValuesInSameTxn(t *testing.T) {
ssMap = query(t, q, labels.NewEqualMatcher("a", "b"))

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)
testutil.Ok(t, q.Close())
}
Expand Down
2 changes: 1 addition & 1 deletion fileutil/sync_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ func Fsync(f *os.File) error {
// to be correctly handled.
func Fdatasync(f *os.File) error {
return syscall.Fdatasync(int(f.Fd()))
}
}
16 changes: 8 additions & 8 deletions head_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,17 @@ func TestHead_Truncate(t *testing.T) {
testutil.Assert(t, postingsC1 == nil, "")

testutil.Equals(t, map[string]struct{}{
"": struct{}{}, // from 'all' postings list
"a": struct{}{},
"b": struct{}{},
"1": struct{}{},
"2": struct{}{},
"": {}, // from 'all' postings list
"a": {},
"b": {},
"1": {},
"2": {},
}, h.symbols)

testutil.Equals(t, map[string]stringset{
"a": stringset{"1": struct{}{}, "2": struct{}{}},
"b": stringset{"1": struct{}{}},
"": stringset{"": struct{}{}},
"a": {"1": struct{}{}, "2": struct{}{}},
"b": {"1": struct{}{}},
"": {"": struct{}{}},
}, h.values)
}

Expand Down
12 changes: 6 additions & 6 deletions index/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ func TestIndexRW_Postings(t *testing.T) {
}

err = iw.AddSymbols(map[string]struct{}{
"a": struct{}{},
"b": struct{}{},
"1": struct{}{},
"2": struct{}{},
"3": struct{}{},
"4": struct{}{},
"a": {},
"b": {},
"1": {},
"2": {},
"3": {},
"4": {},
})
testutil.Ok(t, err)

Expand Down
2 changes: 1 addition & 1 deletion index/postings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func TestRemovedNextStackoverflow(t *testing.T) {
for rp.Next() {
gotElem = true
}

testutil.Ok(t, rp.Err())
testutil.Assert(t, !gotElem, "")
}
Expand Down
6 changes: 3 additions & 3 deletions wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ func (r *walReader) Read(
series = v.([]RefSeries)
}

err := r.decodeSeries(flag, b, &series)
err = r.decodeSeries(flag, b, &series)
if err != nil {
err = errors.Wrap(err, "decode series entry")
break
Expand All @@ -958,7 +958,7 @@ func (r *walReader) Read(
samples = v.([]RefSample)
}

err := r.decodeSamples(flag, b, &samples)
err = r.decodeSamples(flag, b, &samples)
if err != nil {
err = errors.Wrap(err, "decode samples entry")
break
Expand All @@ -980,7 +980,7 @@ func (r *walReader) Read(
deletes = v.([]Stone)
}

err := r.decodeDeletes(flag, b, &deletes)
err = r.decodeDeletes(flag, b, &deletes)
if err != nil {
err = errors.Wrap(err, "decode delete entry")
break
Expand Down