You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by ji...@apache.org on 2025/11/21 09:15:59 UTC

(incubator-seata) branch 2.x updated: test: fix testXARollbackWithResourceLock() to ensure ci runs normally (#7804)

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

jianbin pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 6cee250ffd test: fix testXARollbackWithResourceLock() to ensure ci runs normally (#7804)
6cee250ffd is described below

commit 6cee250ffd5371b002572530e97dabd7b031c70a
Author: maple <gs...@163.com>
AuthorDate: Fri Nov 21 17:15:55 2025 +0800

    test: fix testXARollbackWithResourceLock() to ensure ci runs normally (#7804)
---
 changes/en-us/2.x.md                                                 | 1 +
 changes/zh-cn/2.x.md                                                 | 1 +
 .../org/apache/seata/rm/datasource/xa/ConnectionProxyXATest.java     | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index d27ede804c..af11f8b06e 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -115,6 +115,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#7733](https://github.com/apache/incubator-seata/pull/7733)] add some UT for core module
 - [[#7728](https://github.com/apache/incubator-seata/pull/7728)] add some UT for compatible module
 - [[#7727](https://github.com/apache/incubator-seata/pull/7727)] add some UT for compatible module
+- [[#7804](https://github.com/apache/incubator-seata/pull/7804)] fix testXARollbackWithResourceLock() to ensure ci runs normally
 
 
 ### refactor:
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 828ebd7de5..5dbdd006ea 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -114,6 +114,7 @@
 - [[#7733](https://github.com/apache/incubator-seata/pull/7733)] 为 core 模块添加单测
 - [[#7728](https://github.com/apache/incubator-seata/pull/7728)] 为 compatible 模块添加单测
 - [[#7727](https://github.com/apache/incubator-seata/pull/7727)] 为 compatible 模块添加单测
+- [[#7804](https://github.com/apache/incubator-seata/pull/7804)] 修复 testXARollbackWithResourceLock() 以确保 CI 正常运行
 
 
 ### refactor:
diff --git a/rm-datasource/src/test/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXATest.java b/rm-datasource/src/test/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXATest.java
index e1f451986c..8237bc9b41 100644
--- a/rm-datasource/src/test/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXATest.java
+++ b/rm-datasource/src/test/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXATest.java
@@ -634,7 +634,12 @@ public class ConnectionProxyXATest {
         ConnectionProxyXA connectionProxyXA =
                 new ConnectionProxyXA(mockConnection, mockXAConnection, mockDataSourceResource, xid);
         connectionProxyXA.init();
+        // Set up mock for branch registration to enable XA transaction
+        when(mockResourceManager.branchRegister(eq(BranchType.XA), anyString(), eq(null), eq(xid), eq(null), eq(null)))
+                .thenReturn(branchId);
 
+        // Start XA transaction by setting autoCommit to false
+        connectionProxyXA.setAutoCommit(false);
         // Should not throw exception
         Assertions.assertDoesNotThrow(
                 () -> connectionProxyXA.xaRollback(xid, branchId, null), "xaRollback should not throw exception");


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org