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

Commit

Permalink
Remove uncessary db.Open(), add full stops in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
obitech committed Aug 9, 2019
1 parent a6ee2cc commit 92f160d
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions cmd/tsdb/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ func createRoDb(t *testing.T) (*tsdb.DBReadOnly, func()) {
safeDBOptions.RetentionDuration = 0

testutildb.CreateBlock(nil, tmpdir, testutildb.GenSeries(1, 1, 0, 1))
db, err := tsdb.Open(tmpdir, nil, nil, &safeDBOptions)
if err != nil {
os.RemoveAll(tmpdir)
t.Error(err)
}
if err = db.Close(); err != nil {
t.Error(err)
}

dbRO, err := tsdb.OpenDBReadOnly(tmpdir, nil)
if err != nil {
Expand All @@ -57,7 +49,7 @@ func createRoDb(t *testing.T) (*tsdb.DBReadOnly, func()) {
}

func TestPrintBlocks(t *testing.T) {
db, closeFn := createTestRODBWithBlock(t)
db, closeFn := createRoDb(t)
defer closeFn()

var b bytes.Buffer
Expand All @@ -71,14 +63,14 @@ func TestPrintBlocks(t *testing.T) {
t.Error(err)
}

// Test table header
// Test table header.
actual := b.String()
expected := fmt.Sprintln(printBlocksTableHeader)
if expected != actual {
t.Errorf("expected (%#v) != actual (%#v)", expected, actual)
}

// Set table contents
// Set table contents.
blocks, err := db.Blocks()
if err != nil {
t.Error(err)
Expand All @@ -99,7 +91,7 @@ func TestPrintBlocks(t *testing.T) {
t.Error(err)
}

// Test table contents
// Test table contents.
var actualStdout bytes.Buffer
blocks, err = db.Blocks()
if err != nil {
Expand Down

0 comments on commit 92f160d

Please sign in to comment.