Browse Source

update travis

topic
yedf2 5 years ago
parent
commit
387488048f
  1. 2
      .travis.yml
  2. 31
      test/main_test.go

2
.travis.yml

@ -13,6 +13,6 @@ services:
- redis-server - redis-server
before_install: before_install:
- go get -t -v ./... - go get -t -v ./...
- go get github.com/mattn/goveralls - go get github.com/yedf2/goveralls
script: script:
- $GOPATH/bin/goveralls -service=travis-ci -ignore="examples/*,dtmgrpc/dtmgimp/*.pb.go,bench/*,test/*" - $GOPATH/bin/goveralls -service=travis-ci -ignore="examples/*,dtmgrpc/dtmgimp/*.pb.go,bench/*,test/*"

31
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) { app.POST(examples.BusiAPI+"/TccBSleepCancel", common.WrapHandler(func(c *gin.Context) (interface{}, error) {
return disorderHandler(c) return disorderHandler(c)
})) }))
tenv := os.Getenv("TEST_STORE")
config.Store.Driver = "redis" if tenv == "boltdb" {
config.Store.Host = "localhost" config.Store.Driver = "boltdb"
config.Store.Port = 6379 } else if tenv == "mysql" {
dtmsvr.PopulateDB(false) config.Store.Driver = "mysql"
examples.PopulateDB(false) config.Store.Host = "localhost"
exitIf(m.Run()) config.Store.Port = 3306
config.Store.User = "root"
config.Store.Driver = "boltdb" config.Store.Password = ""
} else {
config.Store.Driver = "redis"
config.Store.Host = "localhost"
config.Store.Port = 6379
}
dtmsvr.PopulateDB(false) dtmsvr.PopulateDB(false)
examples.PopulateDB(false) examples.PopulateDB(false)
exitIf(m.Run()) 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())
} }

Loading…
Cancel
Save