This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-seata-go.git


The following commit(s) were added to refs/heads/master by this push:
     new e085c9b1 fix: align TCC resource manager fallback behavior (#1091)
e085c9b1 is described below

commit e085c9b1292ef4b81c08c0fea6aae7588df53e20
Author: Zhifan C <[email protected]>
AuthorDate: Fri Apr 3 11:24:13 2026 +0800

    fix: align TCC resource manager fallback behavior (#1091)
    
    Co-authored-by: Konnyaku <[email protected]>
    Co-authored-by: ThunGuo <[email protected]>
---
 pkg/rm/tcc/tcc_resource.go      | 10 ++++------
 pkg/rm/tcc/tcc_resource_test.go | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/pkg/rm/tcc/tcc_resource.go b/pkg/rm/tcc/tcc_resource.go
index a6d7b925..5833fd44 100644
--- a/pkg/rm/tcc/tcc_resource.go
+++ b/pkg/rm/tcc/tcc_resource.go
@@ -104,14 +104,12 @@ func (t *TCCResourceManager) BranchReport(ctx 
context.Context, param rm.BranchRe
 }
 
 // LockQuery query lock status of transaction branch
-func (t *TCCResourceManager) LockQuery(ctx context.Context, param 
rm.LockQueryParam) (bool, error) {
-       // TODO implement me
-       panic("implement me")
+func (t *TCCResourceManager) LockQuery(_ context.Context, _ rm.LockQueryParam) 
(bool, error) {
+       return false, nil
 }
 
-func (t *TCCResourceManager) UnregisterResource(resource rm.Resource) error {
-       // TODO implement me
-       panic("implement me")
+func (t *TCCResourceManager) UnregisterResource(_ rm.Resource) error {
+       return fmt.Errorf("UnregisterResource is not supported for 
TCCResourceManager")
 }
 
 func (t *TCCResourceManager) RegisterResource(resource rm.Resource) error {
diff --git a/pkg/rm/tcc/tcc_resource_test.go b/pkg/rm/tcc/tcc_resource_test.go
index e23979bc..0dcfa3a9 100644
--- a/pkg/rm/tcc/tcc_resource_test.go
+++ b/pkg/rm/tcc/tcc_resource_test.go
@@ -33,6 +33,20 @@ import (
        "github.com/stretchr/testify/assert"
 )
 
+type mockTCCManagedResource struct{}
+
+func (m mockTCCManagedResource) GetResourceGroupId() string {
+       return "DEFAULT"
+}
+
+func (m mockTCCManagedResource) GetResourceId() string {
+       return "mock-tcc-resource"
+}
+
+func (m mockTCCManagedResource) GetBranchType() branch.BranchType {
+       return branch.BranchTypeTCC
+}
+
 func TestActionContext(t *testing.T) {
        applicationData := `{"actionContext":{"zhangsan":"lisi"}}`
        businessActionContext := GetTCCResourceManagerInstance().
@@ -69,3 +83,21 @@ func TestBranchReport(t *testing.T) {
 
        assert.Nil(t, err)
 }
+
+func TestLockQueryReturnsFalse(t *testing.T) {
+       lockable, err := 
GetTCCResourceManagerInstance().LockQuery(context.Background(), 
rm.LockQueryParam{
+               BranchType: branch.BranchTypeTCC,
+               ResourceId: "mock-tcc-resource",
+               Xid:        "xid-1",
+               LockKeys:   "ignored",
+       })
+
+       assert.NoError(t, err)
+       assert.False(t, lockable)
+}
+
+func TestUnregisterResourceReturnsExplicitError(t *testing.T) {
+       err := 
GetTCCResourceManagerInstance().UnregisterResource(mockTCCManagedResource{})
+
+       assert.EqualError(t, err, "UnregisterResource is not supported for 
TCCResourceManager")
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to