You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by xi...@apache.org on 2025/03/03 04:09:35 UTC

(incubator-seata) branch 2.x updated: test: fix the runtime exception in the saga test case (#7189)

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

xingfudeshi 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 cde5a7de32 test: fix the runtime exception in the saga test case (#7189)
cde5a7de32 is described below

commit cde5a7de32c1ec2be6aa32afe93c8218f2731056
Author: funkye <ji...@apache.org>
AuthorDate: Mon Mar 3 12:09:31 2025 +0800

    test: fix the runtime exception in the saga test case (#7189)
---
 changes/en-us/2.x.md                                                  | 1 +
 changes/zh-cn/2.x.md                                                  | 1 +
 .../java/org/apache/seata/saga/engine/db/StateMachineDBTests.java     | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 2f363f0292..5ee09f6c0b 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -62,6 +62,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#7098](https://github.com/apache/incubator-seata/pull/7098)] Add unit tests for the `seata-common` module
 - [[#7160](https://github.com/apache/incubator-seata/pull/7160)] Refactored tests in `LowerCaseLinkHashMapTest` to use parameterized unit testing
 - [[#7167](https://github.com/apache/incubator-seata/pull/7167)] Refactored tests in `DurationUtilTest` to simplify and use parameterized unit testing
+- [[#7189](https://github.com/apache/incubator-seata/pull/7189)] fix the runtime exception in the saga test case
 
 ### refactor:
 
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 29fed04339..e46730f8c0 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -62,6 +62,7 @@
 - [[#7098](https://github.com/apache/incubator-seata/pull/7098)] 增加 `seata-common` 模块的测试用例
 - [[#7160](https://github.com/apache/incubator-seata/pull/7160)] 在 LowerCaseLinkHashMapTest 中重构测试,以使用参数化单元测试
 - [[#7167](https://github.com/apache/incubator-seata/pull/7167)] 重构了 DurationUtilTest 中的测试,以简化并使用参数化单元测试
+- [[#7189](https://github.com/apache/incubator-seata/pull/7189)] 修复saga测试用例运行异常
 
 ### refactor:
 
diff --git a/test/src/test/java/org/apache/seata/saga/engine/db/StateMachineDBTests.java b/test/src/test/java/org/apache/seata/saga/engine/db/StateMachineDBTests.java
index 9a30a3ada5..3f2e79fe6a 100644
--- a/test/src/test/java/org/apache/seata/saga/engine/db/StateMachineDBTests.java
+++ b/test/src/test/java/org/apache/seata/saga/engine/db/StateMachineDBTests.java
@@ -27,9 +27,11 @@ import org.apache.seata.common.LockAndCallback;
 import org.apache.seata.common.SagaCostPrint;
 import org.apache.seata.common.exception.FrameworkErrorCode;
 import org.apache.seata.common.exception.StoreException;
+import org.apache.seata.common.loader.EnhancedServiceLoader;
 import org.apache.seata.core.context.RootContext;
 import org.apache.seata.core.exception.TransactionException;
 import org.apache.seata.core.model.GlobalStatus;
+import org.apache.seata.core.model.TransactionManager;
 import org.apache.seata.core.rpc.netty.RmNettyRemotingClient;
 import org.apache.seata.core.rpc.netty.TmNettyRemotingClient;
 import org.apache.seata.saga.engine.AsyncCallback;
@@ -43,6 +45,7 @@ import org.apache.seata.saga.rm.StateMachineEngineHolder;
 import org.apache.seata.saga.statelang.domain.DomainConstants;
 import org.apache.seata.saga.statelang.domain.ExecutionStatus;
 import org.apache.seata.saga.statelang.domain.StateMachineInstance;
+import org.apache.seata.tm.TransactionManagerHolder;
 import org.apache.seata.tm.api.GlobalTransaction;
 import org.apache.seata.tm.api.GlobalTransactionContext;
 import org.junit.jupiter.api.AfterAll;
@@ -68,6 +71,7 @@ public class StateMachineDBTests extends AbstractServerTest {
 
     @BeforeAll
     public static void initApplicationContext() throws InterruptedException {
+        TransactionManagerHolder.set(EnhancedServiceLoader.load(TransactionManager.class));
         startSeataServer();
         TmNettyRemotingClient.getInstance().destroy();
         RmNettyRemotingClient.getInstance().destroy();


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