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

Commit

Permalink
Fix assert order being backwards in a few places (#388)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
  • Loading branch information
csmarchbanks authored and krasi-georgiev committed Sep 21, 2018
1 parent e779603 commit 2db59a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestDataAvailableOnlyAfterCommit(t *testing.T) {
testutil.Ok(t, err)
seriesSet := query(t, querier, labels.NewEqualMatcher("foo", "bar"))

testutil.Equals(t, seriesSet, map[string][]sample{})
testutil.Equals(t, map[string][]sample{}, seriesSet)
testutil.Ok(t, querier.Close())

err = app.Commit()
Expand All @@ -122,7 +122,7 @@ func TestDataAvailableOnlyAfterCommit(t *testing.T) {

seriesSet = query(t, querier, labels.NewEqualMatcher("foo", "bar"))

testutil.Equals(t, seriesSet, map[string][]sample{`{foo="bar"}`: {{t: 0, v: 0}}})
testutil.Equals(t, map[string][]sample{`{foo="bar"}`: {{t: 0, v: 0}}}, seriesSet)
}

func TestDataNotAvailableAfterRollback(t *testing.T) {
Expand All @@ -143,7 +143,7 @@ func TestDataNotAvailableAfterRollback(t *testing.T) {

seriesSet := query(t, querier, labels.NewEqualMatcher("foo", "bar"))

testutil.Equals(t, seriesSet, map[string][]sample{})
testutil.Equals(t, map[string][]sample{}, seriesSet)
}

func TestDBAppenderAddRef(t *testing.T) {
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestDBAppenderAddRef(t *testing.T) {
testutil.Ok(t, err)

err = app2.AddFast(9999999, 1, 1)
testutil.Equals(t, errors.Cause(err), ErrNotFound)
testutil.Equals(t, ErrNotFound, errors.Cause(err))

testutil.Ok(t, app2.Commit())

Expand Down Expand Up @@ -412,7 +412,7 @@ func TestDB_Snapshot(t *testing.T) {
testutil.Ok(t, series.Err())
}
testutil.Ok(t, seriesSet.Err())
testutil.Equals(t, sum, 1000.0)
testutil.Equals(t, 1000.0, sum)
}

func TestDB_SnapshotWithDelete(t *testing.T) {
Expand Down Expand Up @@ -689,7 +689,7 @@ func TestWALFlushedOnDBClose(t *testing.T) {

values, err := q.LabelValues("labelname")
testutil.Ok(t, err)
testutil.Equals(t, values, []string{"labelvalue"})
testutil.Equals(t, []string{"labelvalue"}, values)
}

func TestTombstoneClean(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion head_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,5 +858,5 @@ func TestHead_LogRollback(t *testing.T) {

series, ok := recs[0].([]RefSeries)
testutil.Assert(t, ok, "expected series record but got %+v", recs[0])
testutil.Equals(t, series, []RefSeries{{Ref: 1, Labels: labels.FromStrings("a", "b")}})
testutil.Equals(t, []RefSeries{{Ref: 1, Labels: labels.FromStrings("a", "b")}}, series)
}
2 changes: 1 addition & 1 deletion wal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestSegmentWAL_cut(t *testing.T) {
et, flag, b, err := newWALReader(nil, nil).entry(f)
testutil.Ok(t, err)
testutil.Equals(t, WALEntrySeries, et)
testutil.Equals(t, flag, byte(walSeriesSimple))
testutil.Equals(t, byte(walSeriesSimple), flag)
testutil.Equals(t, []byte("Hello World!!"), b)
}
}
Expand Down

0 comments on commit 2db59a7

Please sign in to comment.