diff --git a/.travis.yml b/.travis.yml index 36e574d..861d93b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,6 @@ services: - redis-server before_install: - go get -t -v ./... - - go get github.com/mattn/goveralls + - go get github.com/yedf2/goveralls script: - $GOPATH/bin/goveralls -service=travis-ci -ignore="examples/*,dtmgrpc/dtmgimp/*.pb.go,bench/*,test/*" diff --git a/test/main_test.go b/test/main_test.go index 6e9a229..9207a06 100644 --- a/test/main_test.go +++ b/test/main_test.go @@ -39,25 +39,22 @@ func TestMain(m *testing.M) { app.POST(examples.BusiAPI+"/TccBSleepCancel", common.WrapHandler(func(c *gin.Context) (interface{}, error) { return disorderHandler(c) })) - - config.Store.Driver = "redis" - config.Store.Host = "localhost" - config.Store.Port = 6379 - dtmsvr.PopulateDB(false) - examples.PopulateDB(false) - exitIf(m.Run()) - - config.Store.Driver = "boltdb" + tenv := os.Getenv("TEST_STORE") + if tenv == "boltdb" { + config.Store.Driver = "boltdb" + } else if tenv == "mysql" { + config.Store.Driver = "mysql" + config.Store.Host = "localhost" + config.Store.Port = 3306 + config.Store.User = "root" + config.Store.Password = "" + } else { + config.Store.Driver = "redis" + config.Store.Host = "localhost" + config.Store.Port = 6379 + } dtmsvr.PopulateDB(false) examples.PopulateDB(false) exitIf(m.Run()) - config.Store.Driver = "mysql" - config.Store.Host = "localhost" - config.Store.Port = 3306 - config.Store.User = "root" - config.Store.Password = "" - dtmsvr.PopulateDB(false) - examples.PopulateDB(false) - exitIf(m.Run()) }