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 a977730fc2 bugfix: ensure visibility of rm and The methods in MockTest
are executed in order (#7662)
a977730fc2 is described below
commit a977730fc2647046fbf65427297a52f47e1d4825
Author: maple <[email protected]>
AuthorDate: Sun Sep 28 09:14:23 2025 +0800
bugfix: ensure visibility of rm and The methods in MockTest are executed in
order (#7662)
---
changes/en-us/2.x.md | 1 +
changes/zh-cn/2.x.md | 1 +
test-old-version/src/test/java/io/seata/MockTest.java | 10 ++++++++++
.../src/test/java/io/seata/core/rpc/netty/RmClientTest.java | 2 +-
4 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 129ddf8c54..d30c2bd7d6 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -37,6 +37,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#7596](https://github.com/apache/incubator-seata/pull/7596)] Fixed the
issue where deserialization failed when the xss filter obtained the default
keyword
- [[#7613](https://github.com/apache/incubator-seata/pull/7613)] Fixed the SQL
error in the datetime format time query in the global lock query
- [[#7624](https://github.com/apache/incubator-seata/pull/7624)] fix the
compatibility issue of yml configuration files
+- [[#7662](https://github.com/apache/incubator-seata/pull/7662)] ensure
visibility of rm and The methods in MockTest are executed in order
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index de96eb1f33..1fcb5dbb73 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -38,6 +38,7 @@
- [[#7596](https://github.com/apache/incubator-seata/pull/7596)]
修复xss过滤器获取默认关键字时反序列化失败的问题
- [[#7613](https://github.com/apache/incubator-seata/pull/7613)]
修复全局锁查询中的datetime时间格式时间查询sql错误
- [[#7624](https://github.com/apache/incubator-seata/pull/7624)]
修复yml配置文件中对于整数的兼容问题
+- [[#7662](https://github.com/apache/incubator-seata/pull/7662)] 确保 rm 的可见性,并且
MockTest 中的方法按顺序执行
### optimize:
diff --git a/test-old-version/src/test/java/io/seata/MockTest.java
b/test-old-version/src/test/java/io/seata/MockTest.java
index 77a1f7791b..aafcf30fd8 100644
--- a/test-old-version/src/test/java/io/seata/MockTest.java
+++ b/test-old-version/src/test/java/io/seata/MockTest.java
@@ -32,13 +32,17 @@ import org.apache.seata.mockserver.MockServer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* the type MockServerTest
*/
+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class MockTest {
static String RESOURCE_ID = "mock-action-061";
@@ -57,6 +61,7 @@ public class MockTest {
}
@Test
+ @Order(1)
public void testCommit() throws Exception {
String xid = doTestCommit(0);
Assertions.assertEquals(1, Action1Impl.getCommitTimes(xid));
@@ -64,6 +69,7 @@ public class MockTest {
}
@Test
+ @Order(2)
public void testCommitRetry() throws Exception {
String xid = doTestCommit(2);
Assertions.assertEquals(3, Action1Impl.getCommitTimes(xid));
@@ -71,6 +77,7 @@ public class MockTest {
}
@Test
+ @Order(3)
public void testRollback() throws Exception {
String xid = doTestRollback(0);
Assertions.assertEquals(0, Action1Impl.getCommitTimes(xid));
@@ -78,6 +85,7 @@ public class MockTest {
}
@Test
+ @Order(4)
public void testRollbackRetry() throws Exception {
String xid = doTestRollback(2);
Assertions.assertEquals(0, Action1Impl.getCommitTimes(xid));
@@ -85,11 +93,13 @@ public class MockTest {
}
@Test
+ @Order(5)
public void testTm() throws Exception {
TmClientTest.testTm();
}
@Test
+ @Order(6)
public void testRm() throws Exception {
RmClientTest.testRm("testRM01");
}
diff --git
a/test-old-version/src/test/java/io/seata/core/rpc/netty/RmClientTest.java
b/test-old-version/src/test/java/io/seata/core/rpc/netty/RmClientTest.java
index b863f4a3af..9d91fd2560 100644
--- a/test-old-version/src/test/java/io/seata/core/rpc/netty/RmClientTest.java
+++ b/test-old-version/src/test/java/io/seata/core/rpc/netty/RmClientTest.java
@@ -35,7 +35,7 @@ import java.util.Map;
public class RmClientTest {
protected static final Logger LOGGER =
LoggerFactory.getLogger(RmClientTest.class);
- private static DefaultResourceManager rm = null;
+ private static volatile DefaultResourceManager rm = null;
public static void testRm(String resourceId) throws TransactionException,
NoSuchMethodException {
String xid = "1111";
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]