add saga rollback pending bug
This commit is contained in:
parent
f90f2cde36
commit
e80f68c387
@ -26,7 +26,7 @@ func sagaNormal(t *testing.T) {
|
||||
|
||||
func sagaCommittedPending(t *testing.T) {
|
||||
saga := genSaga("gid-committedPending", false, false)
|
||||
examples.MainSwitch.TransInResult.SetOnce("PENDING")
|
||||
examples.MainSwitch.TransOutResult.SetOnce("PENDING")
|
||||
saga.Submit()
|
||||
WaitTransProcessed(saga.Gid)
|
||||
assert.Equal(t, []string{"prepared", "prepared", "prepared", "prepared"}, getBranchesStatus(saga.Gid))
|
||||
@ -37,8 +37,11 @@ func sagaCommittedPending(t *testing.T) {
|
||||
|
||||
func sagaRollback(t *testing.T) {
|
||||
saga := genSaga("gid-rollbackSaga2", false, true)
|
||||
examples.MainSwitch.TransOutRevertResult.SetOnce("PENDING")
|
||||
saga.Submit()
|
||||
WaitTransProcessed(saga.Gid)
|
||||
assert.Equal(t, "aborting", getTransStatus(saga.Gid))
|
||||
CronTransOnce(60 * time.Second)
|
||||
assert.Equal(t, "failed", getTransStatus(saga.Gid))
|
||||
assert.Equal(t, []string{"succeed", "succeed", "succeed", "failed"}, getBranchesStatus(saga.Gid))
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ var MainSwitch mainSwitchType
|
||||
|
||||
func handleGeneralBusiness(c *gin.Context, result1 string, result2 string, busi string) (interface{}, error) {
|
||||
info := infoFromContext(c)
|
||||
res := common.OrString(MainSwitch.TransInResult.Fetch(), result2, "SUCCESS")
|
||||
res := common.OrString(result1, result2, "SUCCESS")
|
||||
logrus.Printf("%s %s result: %s", busi, info.String(), res)
|
||||
return M{"dtm_result": res}, nil
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user