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

Commit

Permalink
Add msg parameter to Equals function in testutil
Browse files Browse the repository at this point in the history
Signed-off-by: Camille Janicki <[email protected]>
  • Loading branch information
janickic committed Sep 27, 2018
1 parent a971f52 commit 68a23d3
Show file tree
Hide file tree
Showing 16 changed files with 201 additions and 201 deletions.
6 changes: 3 additions & 3 deletions block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ func TestSetCompactionFailed(t *testing.T) {

b := createEmptyBlock(t, tmpdir, &BlockMeta{Version: 2})

testutil.Equals(t, false, b.meta.Compaction.Failed)
testutil.Equals(t, false, b.meta.Compaction.Failed, "")
testutil.Ok(t, b.setCompactionFailed())
testutil.Equals(t, true, b.meta.Compaction.Failed)
testutil.Equals(t, true, b.meta.Compaction.Failed, "")
testutil.Ok(t, b.Close())

b, err = OpenBlock(tmpdir, nil)
testutil.Ok(t, err)
testutil.Equals(t, true, b.meta.Compaction.Failed)
testutil.Equals(t, true, b.meta.Compaction.Failed, "")
}

// createEmpty block creates a block with the given meta but without any data.
Expand Down
26 changes: 13 additions & 13 deletions checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@ func TestLastCheckpoint(t *testing.T) {
defer os.RemoveAll(dir)

s, k, err := LastCheckpoint(dir)
testutil.Equals(t, ErrNotFound, err)
testutil.Equals(t, ErrNotFound, err, "")

testutil.Ok(t, os.MkdirAll(filepath.Join(dir, "checkpoint.0000"), 0777))
s, k, err = LastCheckpoint(dir)
testutil.Ok(t, err)
testutil.Equals(t, "checkpoint.0000", s)
testutil.Equals(t, 0, k)
testutil.Equals(t, "checkpoint.0000", s, "")
testutil.Equals(t, 0, k, "")

testutil.Ok(t, os.MkdirAll(filepath.Join(dir, "checkpoint.xyz"), 0777))
s, k, err = LastCheckpoint(dir)
testutil.Ok(t, err)
testutil.Equals(t, "checkpoint.0000", s)
testutil.Equals(t, 0, k)
testutil.Equals(t, "checkpoint.0000", s, "")
testutil.Equals(t, 0, k, "")

testutil.Ok(t, os.MkdirAll(filepath.Join(dir, "checkpoint.1"), 0777))
s, k, err = LastCheckpoint(dir)
testutil.Ok(t, err)
testutil.Equals(t, "checkpoint.1", s)
testutil.Equals(t, 1, k)
testutil.Equals(t, "checkpoint.1", s, "")
testutil.Equals(t, 1, k, "")

testutil.Ok(t, os.MkdirAll(filepath.Join(dir, "checkpoint.1000"), 0777))
s, k, err = LastCheckpoint(dir)
testutil.Ok(t, err)
testutil.Equals(t, "checkpoint.1000", s)
testutil.Equals(t, 1000, k)
testutil.Equals(t, "checkpoint.1000", s, "")
testutil.Equals(t, 1000, k, "")
}

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

files, err := fileutil.ReadDir(dir)
testutil.Ok(t, err)
testutil.Equals(t, []string{"checkpoint.02", "checkpoint.03"}, files)
testutil.Equals(t, []string{"checkpoint.02", "checkpoint.03"}, files, "")
}

func TestCheckpoint(t *testing.T) {
Expand Down Expand Up @@ -145,8 +145,8 @@ func TestCheckpoint(t *testing.T) {
// Only the new checkpoint should be left.
files, err := fileutil.ReadDir(dir)
testutil.Ok(t, err)
testutil.Equals(t, 1, len(files))
testutil.Equals(t, "checkpoint.000106", files[0])
testutil.Equals(t, 1, len(files), "")
testutil.Equals(t, "checkpoint.000106", files[0], "")

sr, err := wal.NewSegmentsReader(filepath.Join(dir, "checkpoint.000106"))
testutil.Ok(t, err)
Expand Down Expand Up @@ -176,5 +176,5 @@ func TestCheckpoint(t *testing.T) {
{Ref: 0, Labels: labels.FromStrings("a", "b", "c", "0")},
{Ref: 2, Labels: labels.FromStrings("a", "b", "c", "2")},
{Ref: 4, Labels: labels.FromStrings("a", "b", "c", "4")},
}, series)
}, series, "")
}
6 changes: 3 additions & 3 deletions compact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func TestSplitByRange(t *testing.T) {
}
}

testutil.Equals(t, exp, splitByRange(blocks, c.trange))
testutil.Equals(t, exp, splitByRange(blocks, c.trange), "")
}
}

Expand Down Expand Up @@ -309,7 +309,7 @@ func TestLeveledCompactor_plan(t *testing.T) {
res, err := compactor.plan(c.metas)
testutil.Ok(t, err)

testutil.Equals(t, c.expected, res)
testutil.Equals(t, c.expected, res, "")
}) {
return
}
Expand Down Expand Up @@ -362,7 +362,7 @@ func TestRangeWithFailedCompactionWontGetSelected(t *testing.T) {
res, err := compactor.plan(c.metas)
testutil.Ok(t, err)

testutil.Equals(t, []string(nil), res)
testutil.Equals(t, []string(nil), res, "")
}
}

Expand Down
Loading

0 comments on commit 68a23d3

Please sign in to comment.