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

hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d341fd2ad [type:refactor] add e2e etcd syn (#5063)
6d341fd2ad is described below

commit 6d341fd2ade2189ac91f07376ebb2827066d1e29
Author: SeaChess <[email protected]>
AuthorDate: Thu Aug 24 08:26:11 2023 +0800

    [type:refactor] add e2e etcd syn (#5063)
    
    * test e2e etcd 01
    
    * test e2e etcd 02
    
    * add e2e syn
    
    * add e2e syn 01
---
 .github/workflows/e2e.yaml                         |  2 +-
 .../e2e/testcase/alibabadubbo/DataSynEtcdTest.java | 79 ++++++++++++++++++++++
 .../src/test/resources/docker-compose.mysql.yml    | 18 +++++
 .../e2e/testcase/apachedubbo/DataSynEtcdTest.java  | 79 ++++++++++++++++++++++
 .../src/test/resources/docker-compose.mysql.yml    | 18 +++++
 .../shenyu/e2e/testcase/grpc/DataSynEtcdTest.java  | 79 ++++++++++++++++++++++
 .../src/test/resources/docker-compose.mysql.yml    | 18 +++++
 .../shenyu/e2e/testcase/motan/DataSynEtcdTest.java | 79 ++++++++++++++++++++++
 .../src/test/resources/docker-compose.mysql.yml    | 18 +++++
 .../e2e/testcase/springcloud/DataSynEtcdTest.java  | 79 ++++++++++++++++++++++
 .../src/test/resources/docker-compose.mysql.yml    | 18 +++++
 .../shenyu/e2e/engine/handler/DataSyncHandler.java |  7 +-
 .../e2e/engine/service/DockerServiceCompose.java   |  2 +
 13 files changed, 494 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index 83bb1ce5bd..a62fbe3632 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -150,7 +150,7 @@ jobs:
     if: ${{ needs.changes.outputs.e2e == 'true' }}
     strategy:
       matrix:
-        case: [ "shenyu-e2e-case-spring-cloud", 
"shenyu-e2e-case-apache-dubbo", "shenyu-e2e-case-sofa", 
"shenyu-e2e-case-motan", "shenyu-e2e-case-grpc"]
+        case: [ "shenyu-e2e-case-spring-cloud", 
"shenyu-e2e-case-apache-dubbo", "shenyu-e2e-case-motan", "shenyu-e2e-case-grpc"]
     steps:
       - uses: actions/checkout@v3
         with:
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynEtcdTest.java
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynEtcdTest.java
new file mode 100644
index 0000000000..8c98a0ad21
--- /dev/null
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynEtcdTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.e2e.testcase.alibabadubbo;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.apache.shenyu.e2e.model.response.MetaDataDTO;
+import org.apache.shenyu.e2e.model.response.RuleDTO;
+import org.apache.shenyu.e2e.model.response.SelectorDTO;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * Testing the correctness of Nacos data synchronization method.
+ */
+@ShenYuTest(
+        mode = ShenYuEngineConfigure.Mode.DOCKER,
+        services = {
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "admin",
+                        port = 9095,
+                        baseUrl = "http://{hostname:localhost}:9095";,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "username", value 
= "admin"),
+                                @ShenYuTest.Parameter(key = "password", value 
= "123456"),
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                ),
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "gateway",
+                        port = 9195,
+                        baseUrl = "http://{hostname:localhost}:9195";,
+                        type = 
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                )
+        },
+        dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+public class DataSynEtcdTest {
+    @Test
+    void testDataSyn(final AdminClient adminClient, final GatewayClient 
gatewayClient) throws InterruptedException, JsonProcessingException {
+        adminClient.login();
+        Thread.sleep(10000);
+        List<SelectorDTO> selectorDTOList = adminClient.listAllSelectors();
+        List<SelectorCacheData> selectorCacheList = 
gatewayClient.getSelectorCache();
+        Assertions.assertEquals(selectorDTOList.size(), 
selectorCacheList.size());
+        List<MetaDataDTO> metaDataDTOList = adminClient.listAllMetaData();
+        List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+        Assertions.assertEquals(metaDataDTOList.size(), 
metaDataCacheList.size());
+        List<RuleDTO> ruleDTOList = adminClient.listAllRules();
+        List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+        Assertions.assertEquals(ruleDTOList.size(), ruleCacheList.size());
+    }
+}
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/resources/docker-compose.mysql.yml
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/resources/docker-compose.mysql.yml
index 736b0802dd..7a46641774 100644
--- 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/resources/docker-compose.mysql.yml
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/resources/docker-compose.mysql.yml
@@ -46,6 +46,22 @@ services:
       retries: 3
       start_period: 30s
 
+  etcd:
+    image: bitnami/etcd:3.5
+    environment:
+      - TZ=Asia/Shanghai
+      - ALLOW_NONE_AUTHENTICATION=yes
+      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
+    expose:
+      - 2379
+      - 2380
+    healthcheck:
+      test: [ "CMD", "etcdctl", "endpoint", "health" ]
+      interval: 10s
+      timeout: 5s
+      retries: 3
+      start_period: 30s
+
   admin:
     image: shenyu/admin:latest
     expose:
@@ -59,6 +75,8 @@ services:
         condition: service_healthy
       zookeeper:
         condition: service_healthy
+      etcd:
+        condition: service_healthy
     volumes:
       - 
../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
       - 
/tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynEtcdTest.java
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynEtcdTest.java
new file mode 100644
index 0000000000..1f48b6f23e
--- /dev/null
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynEtcdTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.e2e.testcase.apachedubbo;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.apache.shenyu.e2e.model.response.MetaDataDTO;
+import org.apache.shenyu.e2e.model.response.RuleDTO;
+import org.apache.shenyu.e2e.model.response.SelectorDTO;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * Testing the correctness of Nacos data synchronization method.
+ */
+@ShenYuTest(
+        mode = ShenYuEngineConfigure.Mode.DOCKER,
+        services = {
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "admin",
+                        port = 9095,
+                        baseUrl = "http://{hostname:localhost}:9095";,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "username", value 
= "admin"),
+                                @ShenYuTest.Parameter(key = "password", value 
= "123456"),
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                ),
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "gateway",
+                        port = 9195,
+                        baseUrl = "http://{hostname:localhost}:9195";,
+                        type = 
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                )
+        },
+        dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+public class DataSynEtcdTest {
+    @Test
+    void testDataSyn(final AdminClient adminClient, final GatewayClient 
gatewayClient) throws InterruptedException, JsonProcessingException {
+        adminClient.login();
+        Thread.sleep(10000);
+        List<SelectorDTO> selectorDTOList = adminClient.listAllSelectors();
+        List<SelectorCacheData> selectorCacheList = 
gatewayClient.getSelectorCache();
+        Assertions.assertEquals(selectorDTOList.size(), 
selectorCacheList.size());
+        List<MetaDataDTO> metaDataDTOList = adminClient.listAllMetaData();
+        List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+        Assertions.assertEquals(metaDataDTOList.size(), 
metaDataCacheList.size());
+        List<RuleDTO> ruleDTOList = adminClient.listAllRules();
+        List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+        Assertions.assertEquals(ruleDTOList.size(), ruleCacheList.size());
+    }
+}
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/resources/docker-compose.mysql.yml
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/resources/docker-compose.mysql.yml
index 5b3a67b04f..10c36a4bce 100644
--- 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/resources/docker-compose.mysql.yml
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/resources/docker-compose.mysql.yml
@@ -46,6 +46,22 @@ services:
       retries: 3
       start_period: 30s
 
+  etcd:
+    image: bitnami/etcd:3.5
+    environment:
+      - TZ=Asia/Shanghai
+      - ALLOW_NONE_AUTHENTICATION=yes
+      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
+    expose:
+      - 2379
+      - 2380
+    healthcheck:
+      test: [ "CMD", "etcdctl", "endpoint", "health" ]
+      interval: 10s
+      timeout: 5s
+      retries: 3
+      start_period: 30s
+
   admin:
     image: shenyu/admin:latest
     expose:
@@ -59,6 +75,8 @@ services:
         condition: service_healthy
       zookeeper:
         condition: service_healthy
+      etcd:
+        condition: service_healthy
     environment:
       - SPRING_PROFILES_ACTIVE=mysql
       - spring.datasource.username=shenyue2e
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/DataSynEtcdTest.java
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/DataSynEtcdTest.java
new file mode 100644
index 0000000000..1a46ec413d
--- /dev/null
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/DataSynEtcdTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.e2e.testcase.grpc;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.apache.shenyu.e2e.model.response.MetaDataDTO;
+import org.apache.shenyu.e2e.model.response.RuleDTO;
+import org.apache.shenyu.e2e.model.response.SelectorDTO;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * Testing the correctness of Nacos data synchronization method.
+ */
+@ShenYuTest(
+        mode = ShenYuEngineConfigure.Mode.DOCKER,
+        services = {
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "admin",
+                        port = 9095,
+                        baseUrl = "http://{hostname:localhost}:9095";,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "username", value 
= "admin"),
+                                @ShenYuTest.Parameter(key = "password", value 
= "123456"),
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                ),
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "gateway",
+                        port = 9195,
+                        baseUrl = "http://{hostname:localhost}:9195";,
+                        type = 
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                )
+        },
+        dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+public class DataSynEtcdTest {
+    @Test
+    void testDataSyn(final AdminClient adminClient, final GatewayClient 
gatewayClient) throws InterruptedException, JsonProcessingException {
+        adminClient.login();
+        Thread.sleep(10000);
+        List<SelectorDTO> selectorDTOList = adminClient.listAllSelectors();
+        List<SelectorCacheData> selectorCacheList = 
gatewayClient.getSelectorCache();
+        Assertions.assertEquals(selectorDTOList.size(), 
selectorCacheList.size());
+        List<MetaDataDTO> metaDataDTOList = adminClient.listAllMetaData();
+        List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+        Assertions.assertEquals(metaDataDTOList.size(), 
metaDataCacheList.size());
+        List<RuleDTO> ruleDTOList = adminClient.listAllRules();
+        List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+        Assertions.assertEquals(ruleDTOList.size(), ruleCacheList.size());
+    }
+}
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/resources/docker-compose.mysql.yml
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/resources/docker-compose.mysql.yml
index da6df2b9d9..fb657be914 100644
--- 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/resources/docker-compose.mysql.yml
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/resources/docker-compose.mysql.yml
@@ -46,6 +46,22 @@ services:
       retries: 3
       start_period: 30s
 
+  etcd:
+    image: bitnami/etcd:3.5
+    environment:
+      - TZ=Asia/Shanghai
+      - ALLOW_NONE_AUTHENTICATION=yes
+      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
+    expose:
+      - 2379
+      - 2380
+    healthcheck:
+      test: [ "CMD", "etcdctl", "endpoint", "health" ]
+      interval: 10s
+      timeout: 5s
+      retries: 3
+      start_period: 30s
+
   admin:
     image: shenyu/admin:latest
     expose:
@@ -59,6 +75,8 @@ services:
         condition: service_started
       mysql:
         condition: service_started
+      etcd:
+        condition: service_healthy
     volumes:
       - 
../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
       - 
/tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynEtcdTest.java
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynEtcdTest.java
new file mode 100644
index 0000000000..82d26dca8b
--- /dev/null
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynEtcdTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.e2e.testcase.motan;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.apache.shenyu.e2e.model.response.MetaDataDTO;
+import org.apache.shenyu.e2e.model.response.RuleDTO;
+import org.apache.shenyu.e2e.model.response.SelectorDTO;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * Testing the correctness of Nacos data synchronization method.
+ */
+@ShenYuTest(
+        mode = ShenYuEngineConfigure.Mode.DOCKER,
+        services = {
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "admin",
+                        port = 9095,
+                        baseUrl = "http://{hostname:localhost}:9095";,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "username", value 
= "admin"),
+                                @ShenYuTest.Parameter(key = "password", value 
= "123456"),
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                ),
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "gateway",
+                        port = 9195,
+                        baseUrl = "http://{hostname:localhost}:9195";,
+                        type = 
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                )
+        },
+        dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+public class DataSynEtcdTest {
+    @Test
+    void testDataSyn(final AdminClient adminClient, final GatewayClient 
gatewayClient) throws InterruptedException, JsonProcessingException {
+        adminClient.login();
+        Thread.sleep(10000);
+        List<SelectorDTO> selectorDTOList = adminClient.listAllSelectors();
+        List<SelectorCacheData> selectorCacheList = 
gatewayClient.getSelectorCache();
+        Assertions.assertEquals(selectorDTOList.size(), 
selectorCacheList.size());
+        List<MetaDataDTO> metaDataDTOList = adminClient.listAllMetaData();
+        List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+        Assertions.assertEquals(metaDataDTOList.size(), 
metaDataCacheList.size());
+        List<RuleDTO> ruleDTOList = adminClient.listAllRules();
+        List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+        Assertions.assertEquals(ruleDTOList.size(), ruleCacheList.size());
+    }
+}
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/docker-compose.mysql.yml
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/docker-compose.mysql.yml
index 8d66d2fc39..445ad4b232 100644
--- 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/docker-compose.mysql.yml
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/docker-compose.mysql.yml
@@ -46,6 +46,22 @@ services:
       retries: 3
       start_period: 30s
 
+  etcd:
+    image: bitnami/etcd:3.5
+    environment:
+      - TZ=Asia/Shanghai
+      - ALLOW_NONE_AUTHENTICATION=yes
+      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
+    expose:
+      - 2379
+      - 2380
+    healthcheck:
+      test: ["CMD", "etcdctl", "endpoint", "health"]
+      interval: 10s
+      timeout: 5s
+      retries: 3
+      start_period: 30s
+
   admin:
     image: shenyu/admin:latest
     expose:
@@ -59,6 +75,8 @@ services:
         condition: service_healthy
       mysql:
         condition: service_healthy
+      etcd:
+        condition: service_healthy
     volumes:
       - 
../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
       - 
/tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/DataSynEtcdTest.java
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/DataSynEtcdTest.java
new file mode 100644
index 0000000000..f1b470de83
--- /dev/null
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/DataSynEtcdTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.e2e.testcase.springcloud;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.apache.shenyu.e2e.model.response.MetaDataDTO;
+import org.apache.shenyu.e2e.model.response.RuleDTO;
+import org.apache.shenyu.e2e.model.response.SelectorDTO;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * Testing the correctness of Nacos data synchronization method.
+ */
+@ShenYuTest(
+        mode = ShenYuEngineConfigure.Mode.DOCKER,
+        services = {
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "admin",
+                        port = 9095,
+                        baseUrl = "http://{hostname:localhost}:9095";,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "username", value 
= "admin"),
+                                @ShenYuTest.Parameter(key = "password", value 
= "123456"),
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                ),
+                @ShenYuTest.ServiceConfigure(
+                        serviceName = "gateway",
+                        port = 9195,
+                        baseUrl = "http://{hostname:localhost}:9195";,
+                        type = 
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+                        parameters = {
+                                @ShenYuTest.Parameter(key = "dataSyn", value = 
"etcd")
+                        }
+                )
+        },
+        dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+public class DataSynEtcdTest {
+    @Test
+    void testDataSyn(final AdminClient adminClient, final GatewayClient 
gatewayClient) throws InterruptedException, JsonProcessingException {
+        adminClient.login();
+        Thread.sleep(10000);
+        List<SelectorDTO> selectorDTOList = adminClient.listAllSelectors();
+        List<SelectorCacheData> selectorCacheList = 
gatewayClient.getSelectorCache();
+        Assertions.assertEquals(selectorDTOList.size(), 
selectorCacheList.size());
+        List<MetaDataDTO> metaDataDTOList = adminClient.listAllMetaData();
+        List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+        Assertions.assertEquals(metaDataDTOList.size(), 
metaDataCacheList.size());
+        List<RuleDTO> ruleDTOList = adminClient.listAllRules();
+        List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+        Assertions.assertEquals(ruleDTOList.size(), ruleCacheList.size());
+    }
+}
diff --git 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/resources/docker-compose.mysql.yml
 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/resources/docker-compose.mysql.yml
index f75c07634e..720bf45a90 100644
--- 
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/resources/docker-compose.mysql.yml
+++ 
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/resources/docker-compose.mysql.yml
@@ -59,6 +59,22 @@ services:
       retries: 5
       start_period: 60s
 
+  etcd:
+    image: bitnami/etcd:3.5
+    environment:
+      - TZ=Asia/Shanghai
+      - ALLOW_NONE_AUTHENTICATION=yes
+      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
+    expose:
+      - 2379
+      - 2380
+    healthcheck:
+      test: [ "CMD", "etcdctl", "endpoint", "health" ]
+      interval: 10s
+      timeout: 5s
+      retries: 3
+      start_period: 30s
+
   admin:
     image: shenyu/admin:latest
     expose:
@@ -82,6 +98,8 @@ services:
         condition: service_healthy
       zookeeper:
         condition: service_healthy
+      etcd:
+        condition: service_healthy
     volumes:
       - 
../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
       - 
/tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
diff --git 
a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/handler/DataSyncHandler.java
 
b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/handler/DataSyncHandler.java
index 003acb1a97..04d28c09a2 100644
--- 
a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/handler/DataSyncHandler.java
+++ 
b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/handler/DataSyncHandler.java
@@ -44,7 +44,9 @@ public class DataSyncHandler {
     private static final Map<String, Object> NACOS_MAP = new HashMap<>();
     
     private static final Map<String, Object> ACM_MAP = new HashMap<>();
-    
+
+    private static final Map<String, Object> ETCD_MAP = new HashMap<>();
+
     /**
      * init data sync handler.
      */
@@ -57,6 +59,7 @@ public class DataSyncHandler {
         DATA_SYNC_MAP.put("admin_http", ADMIN_HTTP_MAP);
         DATA_SYNC_MAP.put("gateway_http", GATEWAY_HTTP_MAP);
         DATA_SYNC_MAP.put("nacos", NACOS_MAP);
+        DATA_SYNC_MAP.put("etcd", ETCD_MAP);
 
         ADMIN_WEBSOCKET_MAP.put("enabled", "true");
         GATEWAY_WEBSOCKET_MAP.put("urls", "ws://admin:9095/websocket");
@@ -93,6 +96,8 @@ public class DataSyncHandler {
         GATEWAY_APOLLO_MAP.put("env", "dev");
         GATEWAY_APOLLO_MAP.put("clusterName", "test");
         GATEWAY_APOLLO_MAP.put("namespace", "application");
+
+        ETCD_MAP.put("url", "http://etcd:2379";);
     }
     
     /**
diff --git 
a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/service/DockerServiceCompose.java
 
b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/service/DockerServiceCompose.java
index 4ddcd2d306..118042e872 100644
--- 
a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/service/DockerServiceCompose.java
+++ 
b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/service/DockerServiceCompose.java
@@ -288,6 +288,8 @@ public class DockerServiceCompose implements ServiceCompose 
{
                 synMethod = 
dockerServiceConfigure.getProperties().getProperty("dataSyn");
             }
             parameter.put(synMethod, subParameters);
+            log.info("--- " + subParameters.toString() + " ---");
+            log.info("--- " + synMethod.toString() + " ---");
             String finalSynMethod = synMethod;
             parameter.keySet().removeIf(key -> !key.equals(finalSynMethod));
             DumperOptions options = new DumperOptions();

Reply via email to