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 2024/05/20 09:22:45 UTC

(incubator-seata) branch 2.x updated: test : fix mock-server test, do not shutdown in Runtime.getRuntime().addShutdownHook (#6560)

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 3445656881 test : fix mock-server test, do not shutdown in Runtime.getRuntime().addShutdownHook (#6560)
3445656881 is described below

commit 3445656881bc2e80b0e1bb4c9d486fb397cc4aed
Author: justabug <Bu...@users.noreply.github.com>
AuthorDate: Mon May 20 17:22:41 2024 +0800

    test : fix mock-server test, do not shutdown in Runtime.getRuntime().addShutdownHook (#6560)
---
 changes/en-us/2.x.md                                                    | 1 +
 changes/zh-cn/2.x.md                                                    | 1 +
 .../src/main/java/org/apache/seata/mockserver/MockServer.java           | 2 +-
 .../apache/seata/core/rpc/netty/mockserver/ProtocolTestConstants.java   | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index b2eec93459..d0ade8d5bf 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -164,6 +164,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#6466](https://github.com/apache/incubator-seata/pull/6466)] support redis integration testing
 - [[#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
 
 ### 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 be80538785..96c01a222a 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -160,6 +160,7 @@
 - [[#6466](https://github.com/apache/incubator-seata/pull/6466)] 支持redis的集成测试
 - [[#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 中关闭
 
 ### refactor:
 - [[#6280](https://github.com/apache/incubator-seata/pull/6280)] 使用diagram-js重构Saga设计器
diff --git a/test-mock-server/src/main/java/org/apache/seata/mockserver/MockServer.java b/test-mock-server/src/main/java/org/apache/seata/mockserver/MockServer.java
index f0fe04e455..5f57b66985 100644
--- a/test-mock-server/src/main/java/org/apache/seata/mockserver/MockServer.java
+++ b/test-mock-server/src/main/java/org/apache/seata/mockserver/MockServer.java
@@ -83,7 +83,7 @@ public class MockServer {
                     Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
                         @Override
                         public void run() {
-                            close();
+                            LOGGER.info("system is closing , pid info: " + ManagementFactory.getRuntimeMXBean().getName());
                         }
                     }));
                     LOGGER.info("pid info: " + ManagementFactory.getRuntimeMXBean().getName());
diff --git a/test/src/test/java/org/apache/seata/core/rpc/netty/mockserver/ProtocolTestConstants.java b/test/src/test/java/org/apache/seata/core/rpc/netty/mockserver/ProtocolTestConstants.java
index d848fd890d..15f538af26 100644
--- a/test/src/test/java/org/apache/seata/core/rpc/netty/mockserver/ProtocolTestConstants.java
+++ b/test/src/test/java/org/apache/seata/core/rpc/netty/mockserver/ProtocolTestConstants.java
@@ -20,7 +20,7 @@ package org.apache.seata.core.rpc.netty.mockserver;
  * Mock Constants
  **/
 public class ProtocolTestConstants {
-    public static final String APPLICATION_ID = "my_app_test";
+    public static final String APPLICATION_ID = "mock_tx_app_id";
     public static final String SERVICE_GROUP = "mock_tx_group";
     public static final int MOCK_SERVER_PORT = 8099;
     public static final String MOCK_SERVER_ADDRESS = "0.0.0.0:" + MOCK_SERVER_PORT;


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