This is an automated email from the ASF dual-hosted git repository.
jimin 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 682b830aba test: fix testCompensationStateMachine fail (#6565)
682b830aba is described below
commit 682b830aba1af95a03f826b16d4c5af6c13d5d18
Author: funkye <[email protected]>
AuthorDate: Tue May 21 18:15:39 2024 +0800
test: fix testCompensationStateMachine fail (#6565)
---
changes/en-us/2.x.md | 1 +
changes/zh-cn/2.x.md | 1 +
.../apache/seata/core/rpc/netty/mockserver/MockServerTest.java | 3 +++
.../org/apache/seata/saga/engine/db/StateMachineDBTests.java | 9 +++++++--
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index d0ade8d5bf..8abe9696b5 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -165,6 +165,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6484](https://github.com/apache/incubator-seata/pull/6484)] fix
FileConfigurationTest and MockServerTest fail
- [[#6545](https://github.com/apache/incubator-seata/pull/6545)] fix
TestConfigCustomSPI compatibility test fail
- [[#6560](https://github.com/apache/incubator-seata/pull/6560)] fix
mock-server test, do not shutdown in Runtime.getRuntime().addShutdownHook
+- [[#6565](https://github.com/apache/incubator-seata/pull/6565)] fix
testCompensationStateMachine fail
### refactor:
- [[#6280](https://github.com/apache/incubator-seata/pull/6280)] refactor Saga
designer using diagram-js
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 96c01a222a..c11c390086 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -161,6 +161,7 @@
- [[#6484](https://github.com/apache/incubator-seata/pull/6484)]
修复FileConfigurationTest和MockServerTest失败
- [[#6545](https://github.com/apache/incubator-seata/pull/6545)] 修复
TestConfigCustomSPI 兼容性测试失败
- [[#6560](https://github.com/apache/incubator-seata/pull/6560)] 修复 mockserver
test,不在 Runtime.getRuntime().addShutdownHook 中关闭
+- [[#6565](https://github.com/apache/incubator-seata/pull/6565)] 修复
testCompensationStateMachine 与mockServer单测冲突
### refactor:
- [[#6280](https://github.com/apache/incubator-seata/pull/6280)]
使用diagram-js重构Saga设计器
diff --git
a/test/src/test/java/org/apache/seata/core/rpc/netty/mockserver/MockServerTest.java
b/test/src/test/java/org/apache/seata/core/rpc/netty/mockserver/MockServerTest.java
index 08606e20b3..d1923a0816 100644
---
a/test/src/test/java/org/apache/seata/core/rpc/netty/mockserver/MockServerTest.java
+++
b/test/src/test/java/org/apache/seata/core/rpc/netty/mockserver/MockServerTest.java
@@ -18,6 +18,7 @@ package org.apache.seata.core.rpc.netty.mockserver;
import org.apache.seata.common.ConfigurationKeys;
import org.apache.seata.common.ConfigurationTestHelper;
+import org.apache.seata.config.ConfigurationFactory;
import org.apache.seata.core.exception.TransactionException;
import org.apache.seata.core.model.BranchType;
import org.apache.seata.core.model.GlobalStatus;
@@ -30,6 +31,7 @@ import org.apache.seata.rm.DefaultResourceManager;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,6 +47,7 @@ public class MockServerTest {
@BeforeAll
public static void before() {
+ ConfigurationFactory.reload();
ConfigurationTestHelper.putConfig(ConfigurationKeys.SERVER_SERVICE_PORT_CAMEL,
String.valueOf(ProtocolTestConstants.MOCK_SERVER_PORT));
MockServer.start(ProtocolTestConstants.MOCK_SERVER_PORT);
TmNettyRemotingClient.getInstance().destroy();
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 0cc1fc8113..9a30a3ada5 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
@@ -30,6 +30,8 @@ import org.apache.seata.common.exception.StoreException;
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.rpc.netty.RmNettyRemotingClient;
+import org.apache.seata.core.rpc.netty.TmNettyRemotingClient;
import org.apache.seata.saga.engine.AsyncCallback;
import org.apache.seata.saga.engine.StateMachineEngine;
import org.apache.seata.saga.engine.exception.EngineExecutionException;
@@ -47,6 +49,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -65,9 +68,9 @@ public class StateMachineDBTests extends AbstractServerTest {
@BeforeAll
public static void initApplicationContext() throws InterruptedException {
-
startSeataServer();
-
+ TmNettyRemotingClient.getInstance().destroy();
+ RmNettyRemotingClient.getInstance().destroy();
ApplicationContext applicationContext = new
ClassPathXmlApplicationContext("classpath:saga/spring/statemachine_engine_db_test.xml");
stateMachineEngine = applicationContext.getBean("stateMachineEngine",
StateMachineEngine.class);
StateMachineEngineHolder.setStateMachineEngine(stateMachineEngine);
@@ -76,6 +79,8 @@ public class StateMachineDBTests extends AbstractServerTest {
@AfterAll
public static void destory() throws InterruptedException {
stopSeataServer();
+ TmNettyRemotingClient.getInstance().destroy();
+ RmNettyRemotingClient.getInstance().destroy();
}
private GlobalTransaction getGlobalTransaction(StateMachineInstance
instance) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]