remove db file before testing.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-08-02 16:25:04 +08:00
parent 601472a6db
commit 9dd33575e6
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package buntdb
import ( import (
c "github.com/appleboy/gorush/config" c "github.com/appleboy/gorush/config"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"os"
"testing" "testing"
) )
@ -11,6 +12,10 @@ func TestBuntDBEngine(t *testing.T) {
config := c.BuildDefaultPushConf() config := c.BuildDefaultPushConf()
if _, err := os.Stat(config.Stat.BuntDB.Path); os.IsNotExist(err) {
os.RemoveAll(config.Stat.BuntDB.Path)
}
buntDB := New(config) buntDB := New(config)
buntDB.Init() buntDB.Init()
buntDB.Reset() buntDB.Reset()