This is an automated email from the ASF dual-hosted git repository.
wangjian 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 ec53496c14 test: Isolate compatibility tests from transport protocol
leakage (#8051)
ec53496c14 is described below
commit ec53496c1457e5c1bce00ce379616e3f4041dab8
Author: funkye <[email protected]>
AuthorDate: Tue Apr 14 19:25:53 2026 +0800
test: Isolate compatibility tests from transport protocol leakage (#8051)
---
changes/en-us/2.x.md | 1 +
changes/zh-cn/2.x.md | 1 +
.../netty/multiversion/MultiVersionCompatibilityTest.java | 12 ++++++++++++
3 files changed, 14 insertions(+)
diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 26a56c91e8..12bd27dbc6 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -64,6 +64,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#7962](https://github.com/apache/incubator-seata/pull/7962)] add unit
tests for NacosRegistryProvider and NacosRegistryServiceImpl
- [[#8003](https://github.com/apache/incubator-seata/pull/8003)] Enhance
NacosRegistryServiceImplTest with additional mocks for service name group and
cluster
- [[#7915](https://github.com/apache/incubator-seata/pull/7915)] add unit
tests for saga-engine low coverage components
+- [[#8051](https://github.com/apache/incubator-seata/pull/8051)] isolate
compatibility tests from transport protocol leakage
### refactor:
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 0b1e3de05d..b410d3de8c 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -68,6 +68,7 @@
- [[#7962](https://github.com/apache/incubator-seata/pull/7962)] 为
NacosRegistryProvider 和 NacosRegistryServiceImpl 添加单元测试用例
- [[#8003](https://github.com/apache/incubator-seata/pull/8003)] 为
NacosRegistryServiceImplTest 增加服务名称、分组和集群的额外模拟
- [[#7915](https://github.com/apache/incubator-seata/pull/7915)] 为 saga-engine
添加单元测试用例
+- [[#8051](https://github.com/apache/incubator-seata/pull/8051)]
将兼容性测试与传输协议泄漏隔离
### refactor:
diff --git
a/test-suite/test-new-version/src/test/java/org/apache/seata/core/rpc/netty/multiversion/MultiVersionCompatibilityTest.java
b/test-suite/test-new-version/src/test/java/org/apache/seata/core/rpc/netty/multiversion/MultiVersionCompatibilityTest.java
index 5c806385d4..c52eec9b56 100644
---
a/test-suite/test-new-version/src/test/java/org/apache/seata/core/rpc/netty/multiversion/MultiVersionCompatibilityTest.java
+++
b/test-suite/test-new-version/src/test/java/org/apache/seata/core/rpc/netty/multiversion/MultiVersionCompatibilityTest.java
@@ -34,6 +34,8 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.handler.timeout.IdleStateHandler;
+import org.apache.seata.common.ConfigurationKeys;
+import org.apache.seata.common.ConfigurationTestHelper;
import org.apache.seata.common.XID;
import org.apache.seata.common.metadata.Instance;
import org.apache.seata.common.metadata.Node;
@@ -41,7 +43,9 @@ import org.apache.seata.common.thread.NamedThreadFactory;
import org.apache.seata.common.util.NetUtil;
import org.apache.seata.common.util.StringUtils;
import org.apache.seata.common.util.UUIDGenerator;
+import org.apache.seata.config.ConfigurationFactory;
import org.apache.seata.core.protocol.HeartbeatMessage;
+import org.apache.seata.core.protocol.Protocol;
import org.apache.seata.core.protocol.ProtocolConstants;
import org.apache.seata.core.protocol.RegisterTMRequest;
import org.apache.seata.core.protocol.RegisterTMResponse;
@@ -125,12 +129,15 @@ public abstract class MultiVersionCompatibilityTest {
protected final AtomicReference<Object> requestRef = new
AtomicReference<>();
protected final AtomicReference<Object> responseRef = new
AtomicReference<>();
protected CountDownLatch responseLatch;
+ private String originalTransportProtocol;
// Helper for creating MultiProtocolDecoder with specific version (for V1
tests)
private final MultiProtocolDecoderTest decoderTestHelper = new
MultiProtocolDecoderTest();
@BeforeEach
public void setUp() {
+ originalTransportProtocol =
ConfigurationFactory.getInstance().getConfig(ConfigurationKeys.TRANSPORT_PROTOCOL);
+
ConfigurationTestHelper.putConfig(ConfigurationKeys.TRANSPORT_PROTOCOL,
Protocol.SEATA.value);
bossGroup = new NioEventLoopGroup(1);
workerGroup = new NioEventLoopGroup();
clientGroup = new NioEventLoopGroup();
@@ -165,6 +172,11 @@ public abstract class MultiVersionCompatibilityTest {
bossGroup.shutdownGracefully().sync();
workerGroup.shutdownGracefully().sync();
clientGroup.shutdownGracefully().sync();
+ if (StringUtils.isBlank(originalTransportProtocol)) {
+
ConfigurationTestHelper.removeConfig(ConfigurationKeys.TRANSPORT_PROTOCOL);
+ } else {
+
ConfigurationTestHelper.putConfig(ConfigurationKeys.TRANSPORT_PROTOCOL,
originalTransportProtocol);
+ }
}
// ==================== V1 Server Methods (manual, for legacy simulation)
====================
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]