Browse Source

fix mysql test fail

topic
yedf2 5 years ago
parent
commit
b24576e1f2
  1. 2
      helper/test-cover.sh
  2. 7
      test/main_test.go
  3. 6
      test/msg_barrier_test.go

2
helper/test-cover.sh

@ -2,7 +2,7 @@ set -x
echo "" > coverage.txt
for store in redis mysql boltdb; do
for d in $(go list ./... | grep -v vendor); do
TEST_STORE=$store go test -covermode count -coverprofile=profile.out -coverpkg=github.com/dtm-labs/dtm/dtmcli,github.com/dtm-labs/dtm/dtmcli/dtmimp,github.com/dtm-labs/dtm/dtmcli/logger,github.com/dtm-labs/dtm/dtmgrpc,github.com/dtm-labs/dtm/dtmgrpc/dtmgimp,github.com/dtm-labs/dtm/dtmsvr,github.com/dtm-labs/dtm/dtmsvr/config,github.com/dtm-labs/dtm/dtmsvr/storage,github.com/dtm-labs/dtm/dtmsvr/storage/boltdb,github.com/dtm-labs/dtm/dtmsvr/storage/redis,github.com/dtm-labs/dtm/dtmsvr/storage/registry,github.com/dtm-labs/dtm/dtmsvr/storage/sql,github.com/dtm-labs/dtm/dtmutil -gcflags=-l $d
TEST_STORE=$store go test -covermode count -coverprofile=profile.out -coverpkg=github.com/dtm-labs/dtm/dtmcli,github.com/dtm-labs/dtm/dtmcli/dtmimp,github.com/dtm-labs/dtm/dtmcli/logger,github.com/dtm-labs/dtm/dtmgrpc,github.com/dtm-labs/dtm/dtmgrpc/dtmgimp,github.com/dtm-labs/dtm/dtmsvr,github.com/dtm-labs/dtm/dtmsvr/config,github.com/dtm-labs/dtm/dtmsvr/storage,github.com/dtm-labs/dtm/dtmsvr/storage/boltdb,github.com/dtm-labs/dtm/dtmsvr/storage/redis,github.com/dtm-labs/dtm/dtmsvr/storage/registry,github.com/dtm-labs/dtm/dtmsvr/storage/sql,github.com/dtm-labs/dtm/dtmutil -gcflags=-l $d || exit 1
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
echo > profile.out

7
test/main_test.go

@ -63,6 +63,9 @@ func TestMain(m *testing.M) {
busi.PopulateDB(false)
_ = busi.Startup()
exitIf(m.Run())
r := m.Run()
exitIf(r)
close(dtmsvr.TransProcessedTestChan)
gid, more := <-dtmsvr.TransProcessedTestChan
logger.FatalfIf(more, "extra gid: %s in test chan", gid)
}

6
test/msg_barrier_test.go

@ -57,6 +57,9 @@ func TestMsgPrepareAndSubmitPrepareFailed(t *testing.T) {
}
func TestMsgPrepareAndSubmitCommitFailed(t *testing.T) {
if conf.Store.IsDB() { // cannot patch tx.Commit, because Prepare also do Commit
return
}
before := getBeforeBalances()
gid := dtmimp.GetFuncName()
req := busi.GenTransReq(30, false, false)
@ -78,6 +81,9 @@ func TestMsgPrepareAndSubmitCommitFailed(t *testing.T) {
}
func TestMsgPrepareAndSubmitCommitAfterFailed(t *testing.T) {
if conf.Store.IsDB() { // cannot patch tx.Commit, because Prepare also do Commit
return
}
before := getBeforeBalances()
gid := dtmimp.GetFuncName()
req := busi.GenTransReq(30, false, false)

Loading…
Cancel
Save