-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature add tcc branch report #190
Merged
Merged
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
717b04b
统一命名并且修枚举错误
71a52a4
添加Tcc branchReport
c0f2675
添加 branchReport 单元测试
a4526e8
优化单元测试代码
b8aac7d
branchReport optimize and ci spell fault fix
424a16e
fix:error type fault
a61e32a
format code
22113e6
execute goimport
efdda11
go mod update
891258a
optimize:code review optimize branch report
f59c844
execute goimportsh
339a9a9
Merge branch 'master' into feature_addTccBranchReport
wang1309 d0b70a8
Merge branch 'master' into feature_addTccBranchReport
AlexStocks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
package tcc | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"github.com/seata/seata-go/pkg/protocol/branch" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 提交前执行 go goimport.sh命令格式化下import格式 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
@@ -34,3 +36,16 @@ func TestActionContext(t *testing.T) { | |
assert.Nil(t, err) | ||
assert.Equal(t, `{"zhangsan":"lisi"}`, string(bytes)) | ||
} | ||
|
||
// TestBranchReport | ||
func TestBranchReport(t *testing.T) { | ||
err := GetTCCResourceManagerInstance().BranchReport( | ||
context.Background(), | ||
branch.BranchTypeTCC, | ||
"1111111111", | ||
2645276141, | ||
branch.BranchStatusPhaseoneDone, | ||
`{"actionContext":{"zhangsan":"lisi"}}`) | ||
|
||
assert.Nil(t, err) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看原来已经有 isReportSuccess 方法来判断code是否为成功,这里还需要加branchReportResultDecode方法吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯,从 功能上来看 isReportSuccess 是解析返回值并返回对应响应码,然后在外部根据错误码判断返回结果 ,branchReportResultDecode 是解析返回值并根据错误码判断从而返回最终成功或失败结果,我的想法是把branchReportResultDecode 里面的代码放到 isReportSuccess 里面是否更合适,然后删除branchReportResultDecode 方法。isReportSuccess 从命名含义上看像是返回一个最终的成功或失败结果,而不是返回错误码。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以哈