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

jianbin pushed a commit to branch 2.1.0
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.1.0 by this push:
     new a061e78c5c optimize: optimize workflow and UT (#6550)
a061e78c5c is described below

commit a061e78c5c494c378fd721cc423e9ca04dd6c55c
Author: jimin <sliev...@163.com>
AuthorDate: Thu May 16 10:35:06 2024 +0800

    optimize: optimize workflow and UT (#6550)
---
 .github/workflows/test.yml                         | 23 ++++----
 changes/en-us/2.x.md                               |  3 +
 changes/zh-cn/2.x.md                               |  3 +
 .../apache/seata/config/ConfigurationFactory.java  | 10 ++--
 .../io/seata/config/nacos/NacosConfiguration.java  | 69 +++++++++++-----------
 .../io/seata/config/nacos/TestConfigCustomSPI.java | 38 +++++++++---
 .../src/test/resources/registry-test.conf          |  1 +
 dependencies/pom.xml                               |  2 +-
 8 files changed, 89 insertions(+), 60 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index feda1f9307..0ce1217ad8 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -3,7 +3,6 @@ name: "test"
 on:
   push:
     branches: [ test*, "*.*.*" ]
-
 jobs:
   # job 1
   test:
@@ -43,12 +42,11 @@ jobs:
       - name: "Test with Maven on '${{ matrix.os }}' OS"
         if: matrix.os != 'windows'
         run: |
-          ./mvnw     -version;
-          ./mvnw     -T 4C clean test \
-                     -P args-for-client-test \
-                     -Dspring-boot.version=${{ matrix.springboot }} \
-                     -Dmaven.git-commit-id.skip=true \
-                     -e -B 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
+          if [ "${{ matrix.os }}" == "macos" ]; then
+            ./mvnw -T 4C clean test -P args-for-client-test  -P arrch64 
-Dspring-boot.version=${{ matrix.springboot }} -Dmaven.git-commit-id.skip=true 
-e -B 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
+          else
+            ./mvnw -T 4C clean test -P args-for-client-test 
-Dspring-boot.version=${{ matrix.springboot }} -Dmaven.git-commit-id.skip=true 
-e -B 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
+          fi
       ## step 3.2: for Windows
       - name: "Build with Maven on 'windows' OS (Skip tests)"
         if: matrix.os == 'windows'
@@ -89,12 +87,11 @@ jobs:
       - name: "Test with Maven on '${{ matrix.os }}' OS"
         if: matrix.os != 'windows'
         run: |
-          ./mvnw     -version;
-          ./mvnw     -T 4C clean install \
-                     -P args-for-client-test \
-                     -Dspring-boot.version=${{ matrix.springboot }} \
-                     -Dmaven.git-commit-id.skip=true \
-                     -e -B 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
+          if [ "${{ matrix.os }}" == "macos" ]; then
+            ./mvnw -T 4C clean test -P args-for-client-test  -P arrch64 
-Dspring-boot.version=${{ matrix.springboot }} -Dmaven.git-commit-id.skip=true 
-e -B 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
+          else
+            ./mvnw -T 4C clean test -P args-for-client-test 
-Dspring-boot.version=${{ matrix.springboot }} -Dmaven.git-commit-id.skip=true 
-e -B 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
+          fi
       ## step 3.2: for Windows
       - name: "Build with Maven on 'windows' OS (Skip tests)"
         if: matrix.os == 'windows'
diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 0d15601000..8e3aa477d0 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -131,8 +131,10 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#6458](https://github.com/apache/incubator-seata/pull/6458)] add null 
value check for MAC address
 - [[#6516](https://github.com/apache/incubator-seata/pull/6516)] optimize code 
format
 - [[#6529](https://github.com/apache/incubator-seata/pull/6529)] optimize 
release maven plugin
+- [[#6548](https://github.com/apache/incubator-seata/pull/6548)] upgrade the 
byte-buddy version to 1.14.15
 - [[#6539](https://github.com/apache/incubator-seata/pull/6539)] add 
subcomponents license
 - [[#6540](https://github.com/apache/incubator-seata/pull/6540)] exclude 
com.google.guava:listenablefuture
+- [[#6549](https://github.com/apache/incubator-seata/pull/6549)] macos 
workflow support arm testing
 
 ### security:
 - [[#6069](https://github.com/apache/incubator-seata/pull/6069)] Upgrade Guava 
dependencies to fix security vulnerabilities
@@ -156,6 +158,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#6456](https://github.com/apache/incubator-seata/pull/6456)] adjust the 
test cases related to dynamic configuration
 - [[#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
 
 ### 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 4182ac7177..2e6b21fac3 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -130,8 +130,10 @@
 - [[#6412](https://github.com/apache/incubator-seata/pull/6412)] 优化 core 兼容模块
 - [[#6518](https://github.com/apache/incubator-seata/pull/6518)] 优化 
ConfigurationCache 代理方法
 - [[#6529](https://github.com/apache/incubator-seata/pull/6529)] 优化发布插件
+- [[#6548](https://github.com/apache/incubator-seata/pull/6548)] 
升级byte-buddy版本至1.14.15
 - [[#6539](https://github.com/apache/incubator-seata/pull/6539)] 增加组件 license
 - [[#6540](https://github.com/apache/incubator-seata/pull/6540)] 排除  
com.google.guava:listenablefuture 依赖
+- [[#6549](https://github.com/apache/incubator-seata/pull/6549)] 支持macos 
arm架构单测
 
 ### security:
 - [[#6069](https://github.com/apache/incubator-seata/pull/6069)] 
升级Guava依赖版本,修复安全漏洞
@@ -153,6 +155,7 @@
 - [[#6456](https://github.com/apache/incubator-seata/pull/6456)] 调整动态配置监听测试用例
 - [[#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 兼容性测试失败
 
 ### refactor:
 - [[#6280](https://github.com/apache/incubator-seata/pull/6280)] 
使用diagram-js重构Saga设计器
diff --git 
a/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationFactory.java
 
b/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationFactory.java
index 22d94903f6..a05235afbc 100644
--- 
a/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationFactory.java
+++ 
b/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationFactory.java
@@ -173,8 +173,6 @@ public final class ConfigurationFactory {
             if (null != configurationCache) {
                 extConfiguration = configurationCache;
             }
-        } catch (EnhancedServiceNotFoundException ignore) {
-
         } catch (Exception e) {
             LOGGER.error("failed to load configurationCacheProvider:{}", 
e.getMessage(), e);
         }
@@ -225,7 +223,7 @@ public final class ConfigurationFactory {
         return null;
     }
 
-    protected static void reload() {
+    public static void reload() {
         ConfigurationCache.clear();
         initOriginConfiguraction();
         load();
@@ -298,13 +296,15 @@ public final class ConfigurationFactory {
             ConfigurationChangeEvent newEvent = new ConfigurationChangeEvent();
             
newEvent.setDataId(event.getDataId()).setOldValue(event.getOldValue()).setNewValue(event.getNewValue())
                 .setNamespace(event.getNamespace());
-            
newEvent.setChangeType(ConfigurationChangeType.values()[event.getChangeType().ordinal()]);
+            if (event.getChangeType() != null) {
+                
newEvent.setChangeType(ConfigurationChangeType.values()[event.getChangeType().ordinal()]);
+            }
             return newEvent;
         }
 
         @Override
         public void onChangeEvent(io.seata.config.ConfigurationChangeEvent 
event) {
-            listener.onChangeEvent(convert(event));
+            onProcessEvent(event);
         }
 
         @Override
diff --git 
a/config/seata-config-nacos/src/test/java/io/seata/config/nacos/NacosConfiguration.java
 
b/config/seata-config-nacos/src/test/java/io/seata/config/nacos/NacosConfiguration.java
index e3c3116bd3..87e3c39dbf 100644
--- 
a/config/seata-config-nacos/src/test/java/io/seata/config/nacos/NacosConfiguration.java
+++ 
b/config/seata-config-nacos/src/test/java/io/seata/config/nacos/NacosConfiguration.java
@@ -23,6 +23,8 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
 
 import com.alibaba.nacos.api.NacosFactory;
 import com.alibaba.nacos.api.config.ConfigService;
@@ -198,7 +200,7 @@ public class NacosConfiguration extends 
io.seata.config.AbstractConfiguration {
         }
     }
 
-    private static Properties getConfigProperties() {
+    protected static Properties getConfigProperties() {
         Properties properties = new Properties();
         
properties.setProperty(ConfigurationKeys.IS_USE_CLOUD_NAMESPACE_PARSING, 
USE_PARSE_RULE);
         properties.setProperty(ConfigurationKeys.IS_USE_ENDPOINT_PARSING_RULE, 
USE_PARSE_RULE);
@@ -278,7 +280,6 @@ public class NacosConfiguration extends 
io.seata.config.AbstractConfiguration {
      * Non-blocking subscriptions prohibit adding subscriptions in the thread 
pool to prevent thread termination
      */
     public static class NacosListener extends AbstractSharedListener {
-        private final String dataId;
         private final ConfigurationChangeListener listener;
 
         /**
@@ -288,7 +289,6 @@ public class NacosConfiguration extends 
io.seata.config.AbstractConfiguration {
          * @param listener the listener
          */
         public NacosListener(String dataId, ConfigurationChangeListener 
listener) {
-            this.dataId = dataId;
             this.listener = listener;
         }
 
@@ -303,42 +303,45 @@ public class NacosConfiguration extends 
io.seata.config.AbstractConfiguration {
 
         @Override
         public void innerReceive(String dataId, String group, String 
configInfo) {
-            //The new configuration method to puts all configurations into a 
dateId
-            if (getNacosDataId().equals(dataId)) {
-                Properties seataConfigNew = new Properties();
-                if (StringUtils.isNotBlank(configInfo)) {
-                    try {
-                        seataConfigNew = 
ConfigProcessor.processConfig(configInfo, getNacosDataType());
-                    } catch (IOException e) {
-                        LOGGER.error("load config properties error", e);
-                        return;
+            try {
+                //The new configuration method to puts all configurations into 
a dateId
+                if (getNacosDataId().equals(dataId)) {
+                    Properties seataConfigNew = new Properties();
+                    if (StringUtils.isNotBlank(configInfo)) {
+                        try {
+                            seataConfigNew = 
ConfigProcessor.processConfig(configInfo, getNacosDataType());
+                        } catch (IOException e) {
+                            LOGGER.error("load config properties error", e);
+                            return;
+                        }
                     }
-                }
-
-                //Get all the monitored dataids and judge whether it has been 
modified
-                for (Map.Entry<String, 
ConcurrentMap<ConfigurationChangeListener, NacosListener>> entry :
-                    CONFIG_LISTENERS_MAP.entrySet()) {
-                    String listenedDataId = entry.getKey();
-                    String propertyOld = 
seataConfig.getProperty(listenedDataId, "");
-                    String propertyNew = 
seataConfigNew.getProperty(listenedDataId, "");
-                    if (!propertyOld.equals(propertyNew)) {
-                        ConfigurationChangeEvent event = new 
ConfigurationChangeEvent().setDataId(listenedDataId)
-                            .setNewValue(propertyNew).setNamespace(group);
-
-                        ConcurrentMap<ConfigurationChangeListener, 
NacosListener> configListeners = entry.getValue();
-                        for (ConfigurationChangeListener configListener : 
configListeners.keySet()) {
-                            configListener.onProcessEvent(event);
+                    //Get all the monitored dataids and judge whether it has 
been modified
+                    for (Map.Entry<String, 
ConcurrentMap<ConfigurationChangeListener, NacosListener>> entry : 
CONFIG_LISTENERS_MAP.entrySet()) {
+                        String listenedDataId = entry.getKey();
+                        String propertyOld = 
seataConfig.getProperty(listenedDataId, "");
+                        String propertyNew = 
seataConfigNew.getProperty(listenedDataId, "");
+                        if (!propertyOld.equals(propertyNew)) {
+                            ConfigurationChangeEvent event =
+                                new 
ConfigurationChangeEvent().setDataId(listenedDataId).setNewValue(propertyNew)
+                                    .setNamespace(group);
+
+                            ConcurrentMap<ConfigurationChangeListener, 
NacosListener> configListeners =
+                                entry.getValue();
+                            for (ConfigurationChangeListener configListener : 
configListeners.keySet()) {
+                                configListener.onProcessEvent(event);
+                            }
                         }
                     }
-                }
 
-                seataConfig = seataConfigNew;
-                return;
+                    seataConfig = seataConfigNew;
+                    return;
+                }
+            } catch (Exception e) {
+                LOGGER.error("innerReceive error: {}", e.getMessage(), e);
             }
-
             //Compatible with old writing
-            ConfigurationChangeEvent event = new 
ConfigurationChangeEvent().setDataId(dataId).setNewValue(configInfo)
-                .setNamespace(group);
+            ConfigurationChangeEvent event =
+                new 
ConfigurationChangeEvent().setDataId(dataId).setNewValue(configInfo).setNamespace(group);
             listener.onProcessEvent(event);
         }
     }
diff --git 
a/config/seata-config-nacos/src/test/java/io/seata/config/nacos/TestConfigCustomSPI.java
 
b/config/seata-config-nacos/src/test/java/io/seata/config/nacos/TestConfigCustomSPI.java
index d65b67748d..54e1bbd846 100644
--- 
a/config/seata-config-nacos/src/test/java/io/seata/config/nacos/TestConfigCustomSPI.java
+++ 
b/config/seata-config-nacos/src/test/java/io/seata/config/nacos/TestConfigCustomSPI.java
@@ -16,19 +16,24 @@
  */
 package io.seata.config.nacos;
 
+import java.security.SecureRandom;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import com.alibaba.nacos.api.NacosFactory;
 import com.alibaba.nacos.api.config.ConfigService;
+import com.alibaba.nacos.api.config.listener.AbstractSharedListener;
 import com.alibaba.nacos.api.exception.NacosException;
 
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import org.apache.seata.config.CachedConfigurationChangeListener;
 import org.apache.seata.config.Configuration;
+import org.apache.seata.config.ConfigurationCache;
 import org.apache.seata.config.ConfigurationChangeEvent;
 import org.apache.seata.config.ConfigurationChangeListener;
 import org.apache.seata.config.ConfigurationFactory;
@@ -39,23 +44,30 @@ import org.junit.jupiter.api.Test;
 
 public class TestConfigCustomSPI {
 
-    private static final Config FILE_CONFIG = 
ConfigFactory.load("registry-test.conf");
+    private static  Config FILE_CONFIG;
     private static ConfigService configService;
 
+    private static final String CHARACTERS = "abcdefghijklmnopqrstuvwxyz";
+
+    private static final int STRING_LENGTH = 6;
+
+    private static final SecureRandom random = new SecureRandom();
+
     @BeforeAll
     public static void setup() throws NacosException {
-        String serverAddr = FILE_CONFIG.getString("config.test.serverAddr");
-        Properties properties = new Properties();
-        properties.put("serverAddr", serverAddr);
-        configService = NacosFactory.createConfigService(properties);
         System.setProperty("seataEnv", "test");
+        ConfigurationFactory.reload();
+        ConfigurationCache.clear();
+        FILE_CONFIG = ConfigFactory.load("registry-test.conf");
+        configService = 
NacosFactory.createConfigService(NacosConfiguration.getConfigProperties());
     }
 
     @Test
     public void testGetConfigProperties() throws Exception {
         Assertions.assertNotNull(configService);
         Configuration configuration = ConfigurationFactory.getInstance();
-        String dataId = "nacos.config.custom.spi.test";
+        String postfix = generateRandomString();
+        String dataId = "nacos.config.custom.spi." + postfix;
         String group = FILE_CONFIG.getString("config.test.group");
         String content = "seata";
         CountDownLatch listenerCountDown = new CountDownLatch(1);
@@ -68,17 +80,27 @@ public class TestConfigCustomSPI {
         });
         configService.publishConfig(dataId, group, content);
         boolean reachZero = listenerCountDown.await(5, TimeUnit.SECONDS);
-        Assertions.assertFalse(reachZero);
+        Assertions.assertTrue(reachZero);
         //get config
         String config = configuration.getConfig(dataId);
         Assertions.assertEquals(content, config);
         //listener
         Set<ConfigurationChangeListener> listeners = 
configuration.getConfigListeners(dataId);
-        Assertions.assertEquals(2, listeners.size());
+        Assertions.assertEquals(1, listeners.size());
+
+    }
 
+    public static String generateRandomString() {
+        StringBuilder sb = new StringBuilder(STRING_LENGTH);
+        for (int i = 0; i < STRING_LENGTH; i++) {
+            sb.append(CHARACTERS.charAt(random.nextInt(CHARACTERS.length())));
+        }
+        return sb.toString();
     }
 
     @AfterAll
     public static void afterAll() {
+        ConfigurationFactory.reload();
+        ConfigurationCache.clear();
     }
 }
diff --git a/config/seata-config-nacos/src/test/resources/registry-test.conf 
b/config/seata-config-nacos/src/test/resources/registry-test.conf
index 2b094f0433..0def5192c6 100644
--- a/config/seata-config-nacos/src/test/resources/registry-test.conf
+++ b/config/seata-config-nacos/src/test/resources/registry-test.conf
@@ -92,6 +92,7 @@ config {
       serverAddr = "console.nacos.io:80"
       namespace = ""
       group = "SEATA_GROUP"
+      dataId = ""
   }
   consul {
     serverAddr = "127.0.0.1:8500"
diff --git a/dependencies/pom.xml b/dependencies/pom.xml
index 54dc3d8abb..48b73bccbc 100644
--- a/dependencies/pom.xml
+++ b/dependencies/pom.xml
@@ -39,7 +39,7 @@
         <dubbo-seata.version>1.0.2</dubbo-seata.version>
         <brpc.version>2.5.9</brpc.version>
         <hsf.version>1.8.3</hsf.version>
-        <bytebuddy.version>1.12.17</bytebuddy.version>
+        <bytebuddy.version>1.14.15</bytebuddy.version>
         <dubbo.alibaba.version>2.6.10</dubbo.alibaba.version>
         <sofa.rpc.version>5.6.5</sofa.rpc.version>
         <fastjson.version>1.2.83</fastjson.version>


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

Reply via email to