From fd82b25cfda7d3717246619600be695954a81c4a Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Fri, 24 Aug 2018 17:03:45 -0700 Subject: [PATCH] fix db test --- db/db_test.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/db/db_test.go b/db/db_test.go index c351d9289..c88c2e555 100644 --- a/db/db_test.go +++ b/db/db_test.go @@ -1,4 +1,4 @@ -package db_test +package db import ( "bytes" @@ -8,16 +8,14 @@ import ( "strconv" "sync" "testing" - - "github.com/simple-rules/harmony-benchmark/db" ) -func newTestLDB() (*db.LDBDatabase, func()) { +func newTestLDB() (*LDBDatabase, func()) { dirname, err := ioutil.TempDir(os.TempDir(), "db_test_") if err != nil { panic("failed to create test file: " + err.Error()) } - db, err := db.NewLDBDatabase(dirname, 0, 0) + db, err := NewLDBDatabase(dirname, 0, 0) if err != nil { panic("failed to create test database: " + err.Error()) } @@ -37,10 +35,10 @@ func TestLDB_PutGet(t *testing.T) { } func TestMemoryDB_PutGet(t *testing.T) { - testPutGet(db.NewMemDatabase(), t) + testPutGet(NewMemDatabase(), t) } -func testPutGet(db db.Database, t *testing.T) { +func testPutGet(db Database, t *testing.T) { t.Parallel() for _, k := range test_values { @@ -136,10 +134,10 @@ func TestLDB_ParallelPutGet(t *testing.T) { } func TestMemoryDB_ParallelPutGet(t *testing.T) { - testParallelPutGet(db.NewMemDatabase(), t) + testParallelPutGet(NewMemDatabase(), t) } -func testParallelPutGet(db db.Database, t *testing.T) { +func testParallelPutGet(db Database, t *testing.T) { const n = 8 var pending sync.WaitGroup