From 4271cb885d05716eb4f0bc10811b98ddcda65470 Mon Sep 17 00:00:00 2001 From: SeaChess <80969210+HaiqiQin@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:27:46 +0800 Subject: [PATCH] [type: feature] replenish alibaba-dubbo syn method (#4931) * replenish alibaba-dubbo syn method 01 * replenish alibaba-dubbo syn method 02 * replenish alibaba-dubbo syn method 03 * replenish alibaba-dubbo syn method 04 * replenish alibaba-dubbo syn method 05 * replenish alibaba-dubbo syn method 06 * replenish alibaba-dubbo syn method 07 * replenish alibaba-dubbo syn method 08 * replenish alibaba-dubbo syn method 09 * replenish alibaba-dubbo syn method 10 --------- Co-authored-by: dragon-zhang --- .../alibabadubbo/DataSynHttpTest.java | 74 ++++++++++++++++++ .../alibabadubbo/DataSynNacosTest.java | 75 +++++++++++++++++++ .../alibabadubbo/DataSynZookeeperTest.java | 75 +++++++++++++++++++ .../test/resources/docker-compose.mysql.yml | 31 +++++++- .../testcase/apachedubbo/DataSynHttpTest.java | 2 +- .../apachedubbo/DataSynNacosTest.java | 2 +- .../apachedubbo/DataSynZookeeperTest.java | 2 +- .../test/resources/docker-compose.mysql.yml | 25 +++++-- .../e2e/testcase/sofa/DataSynHttpTest.java | 2 +- .../e2e/testcase/sofa/DataSynNacosTest.java | 2 +- .../testcase/sofa/DataSynZookeeperTest.java | 2 +- .../test/resources/docker-compose.mysql.yml | 26 ++++--- .../test/resources/docker-compose.mysql.yml | 22 ++++-- 13 files changed, 313 insertions(+), 27 deletions(-) create mode 100644 shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynHttpTest.java create mode 100644 shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynNacosTest.java create mode 100644 shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynZookeeperTest.java diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynHttpTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynHttpTest.java new file mode 100644 index 000000000000..aac495b5e9c0 --- /dev/null +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynHttpTest.java @@ -0,0 +1,74 @@ +/* + * 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.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.List; + +/** + * Testing the correctness of Http 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 = "admin_http") + } + ), + @ShenYuTest.ServiceConfigure( + serviceName = "gateway", + port = 9195, + baseUrl = "http://{hostname:localhost}:9195", + type = ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY, + parameters = { + @ShenYuTest.Parameter(key = "dataSyn", value = "gateway_http") + } + ) + }, + dockerComposeFile = "classpath:./docker-compose.mysql.yml" +) +public class DataSynHttpTest { + + @Test + void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { + adminClient.login(); + Thread.sleep(10000); + List metaDataCacheList = gatewayClient.getMetaDataCache(); + List selectorCacheList = gatewayClient.getSelectorCache(); + List ruleCacheList = gatewayClient.getRuleCache(); + Assertions.assertEquals(1, selectorCacheList.size()); + Assertions.assertEquals(25, metaDataCacheList.size()); + Assertions.assertEquals(25, ruleCacheList.size()); + } +} diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynNacosTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynNacosTest.java new file mode 100644 index 000000000000..b73fb8c04ef6 --- /dev/null +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynNacosTest.java @@ -0,0 +1,75 @@ +/* + * 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.annotation.ShenYuTest.Parameter; +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.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 = { + @Parameter(key = "username", value = "admin"), + @Parameter(key = "password", value = "123456"), + @Parameter(key = "dataSyn", value = "nacos") + } + ), + @ShenYuTest.ServiceConfigure( + serviceName = "gateway", + port = 9195, + baseUrl = "http://{hostname:localhost}:9195", + type = ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY, + parameters = { + @Parameter(key = "dataSyn", value = "nacos") + } + ) + }, + dockerComposeFile = "classpath:./docker-compose.mysql.yml" +) +public class DataSynNacosTest { + + @Test + void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { + adminClient.login(); + Thread.sleep(10000); + List metaDataCacheList = gatewayClient.getMetaDataCache(); + List selectorCacheList = gatewayClient.getSelectorCache(); + List ruleCacheList = gatewayClient.getRuleCache(); + Assertions.assertEquals(1, selectorCacheList.size()); + Assertions.assertEquals(25, metaDataCacheList.size()); + Assertions.assertEquals(25, ruleCacheList.size()); + } +} diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynZookeeperTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynZookeeperTest.java new file mode 100644 index 000000000000..f649b310277b --- /dev/null +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/DataSynZookeeperTest.java @@ -0,0 +1,75 @@ +/* + * 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.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.List; + +/** + * Testing the correctness of Apollo 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 = "zookeeper") + } + ), + @ShenYuTest.ServiceConfigure( + serviceName = "gateway", + port = 9195, + baseUrl = "http://{hostname:localhost}:9195", + type = ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY, + parameters = { + @ShenYuTest.Parameter(key = "dataSyn", value = "zookeeper") + } + ) + }, + dockerComposeFile = "classpath:./docker-compose.mysql.yml" +) +public class DataSynZookeeperTest { + + @Test + void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { + adminClient.login(); + Thread.sleep(10000); + List metaDataCacheList = gatewayClient.getMetaDataCache(); + List selectorCacheList = gatewayClient.getSelectorCache(); + List ruleCacheList = gatewayClient.getRuleCache(); + Assertions.assertEquals(1, selectorCacheList.size()); + Assertions.assertEquals(25, metaDataCacheList.size()); + Assertions.assertEquals(25, 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 381baa3c272c..83eb2052986b 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 @@ -23,6 +23,26 @@ services: restart: always expose: - 2181 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/commands/stat"] + interval: 10s + timeout: 5s + retries: 3 + + nacos: + image: nacos/nacos-server:v2.2.3 + environment: + - TZ=Asia/Shanghai + - MODE=standalone + expose: + - 8848 + - 9848 + - 9849 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8848/nacos/actuator/health"] + interval: 10s + timeout: 5s + retries: 3 admin: image: shenyu/admin:latest @@ -30,6 +50,13 @@ services: - 9095 ports: - "9095:9095" + depends_on: + mysql: + condition: service_healthy + nacos: + condition: service_healthy + zookeeper: + 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 @@ -59,7 +86,7 @@ services: - dubbo.zk=zookeeper://zookeeper:2181 - shenyu.register.serverLists=http://admin:9095 depends_on: - gateway: + admin: condition: service_healthy gateway: @@ -69,7 +96,7 @@ services: ports: - "9195:9195" depends_on: - admin: + dubbo: condition: service_healthy volumes: - ../../target/test-classes/bootstrap-application.yml:/opt/shenyu-bootstrap/conf/application.yml diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynHttpTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynHttpTest.java index 3e355e027e06..81e3e42ebd74 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynHttpTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynHttpTest.java @@ -63,7 +63,7 @@ public class DataSynHttpTest { @Test void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { adminClient.login(); - Thread.sleep(20000); + Thread.sleep(10000); List metaDataCacheList = gatewayClient.getMetaDataCache(); List selectorCacheList = gatewayClient.getSelectorCache(); List ruleCacheList = gatewayClient.getRuleCache(); diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynNacosTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynNacosTest.java index d669448e6e7a..5f0b49d2300a 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynNacosTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynNacosTest.java @@ -64,7 +64,7 @@ public class DataSynNacosTest { @Test void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { adminClient.login(); - Thread.sleep(20000); + Thread.sleep(10000); List metaDataCacheList = gatewayClient.getMetaDataCache(); List selectorCacheList = gatewayClient.getSelectorCache(); List ruleCacheList = gatewayClient.getRuleCache(); diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynZookeeperTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynZookeeperTest.java index 6ac15c7fcc74..f40fcca053ca 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynZookeeperTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/DataSynZookeeperTest.java @@ -63,7 +63,7 @@ public class DataSynZookeeperTest { @Test void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { adminClient.login(); - Thread.sleep(20000); + Thread.sleep(10000); List metaDataCacheList = gatewayClient.getMetaDataCache(); List selectorCacheList = gatewayClient.getSelectorCache(); List ruleCacheList = gatewayClient.getRuleCache(); 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 849d1149a154..783418e22ea2 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 @@ -21,6 +21,13 @@ services: zookeeper: image: zookeeper:3.8 restart: always + expose: + - 2181 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/commands/stat"] + interval: 10s + timeout: 5s + retries: 3 nacos: image: nacos/nacos-server:v2.2.3 @@ -31,10 +38,11 @@ services: - 8848 - 9848 - 9849 - ports: - - "8848:8848" - - "9848:9848" - - "9849:9849" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8848/nacos/actuator/health"] + interval: 10s + timeout: 5s + retries: 3 admin: image: shenyu/admin:latest @@ -42,6 +50,13 @@ services: - 9095 ports: - "9095:9095" + depends_on: + mysql: + condition: service_healthy + nacos: + condition: service_healthy + zookeeper: + condition: service_healthy environment: - SPRING_PROFILES_ACTIVE=mysql - spring.datasource.username=shenyue2e @@ -81,7 +96,7 @@ services: ports: - "9195:9195" depends_on: - admin: + dubbo: condition: service_healthy volumes: - ../../target/test-classes/bootstrap-application.yml:/opt/shenyu-bootstrap/conf/application.yml diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynHttpTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynHttpTest.java index de6ca59d975d..395270344cee 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynHttpTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynHttpTest.java @@ -63,7 +63,7 @@ public class DataSynHttpTest { @Test void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { adminClient.login(); - Thread.sleep(20000); + Thread.sleep(10000); List metaDataCacheList = gatewayClient.getMetaDataCache(); List selectorCacheList = gatewayClient.getSelectorCache(); List ruleCacheList = gatewayClient.getRuleCache(); diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynNacosTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynNacosTest.java index 25f688d9c1dd..23fb95a370c3 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynNacosTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynNacosTest.java @@ -64,7 +64,7 @@ public class DataSynNacosTest { @Test void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { adminClient.login(); - Thread.sleep(20000); + Thread.sleep(10000); List metaDataCacheList = gatewayClient.getMetaDataCache(); List selectorCacheList = gatewayClient.getSelectorCache(); List ruleCacheList = gatewayClient.getRuleCache(); diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynZookeeperTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynZookeeperTest.java index 1c5d7270ab18..2e641e0d4bc2 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynZookeeperTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynZookeeperTest.java @@ -63,7 +63,7 @@ public class DataSynZookeeperTest { @Test void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws InterruptedException, JsonProcessingException { adminClient.login(); - Thread.sleep(20000); + Thread.sleep(10000); List metaDataCacheList = gatewayClient.getMetaDataCache(); List selectorCacheList = gatewayClient.getSelectorCache(); List ruleCacheList = gatewayClient.getRuleCache(); diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/resources/docker-compose.mysql.yml b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/resources/docker-compose.mysql.yml index 226168673f57..d5b4113a367d 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/resources/docker-compose.mysql.yml +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/resources/docker-compose.mysql.yml @@ -23,8 +23,11 @@ services: restart: always expose: - 2181 - ports: - - "2181:2181" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/commands/stat"] + interval: 10s + timeout: 5s + retries: 3 nacos: image: nacos/nacos-server:v2.2.3 @@ -35,10 +38,11 @@ services: - 8848 - 9848 - 9849 - ports: - - "8848:8848" - - "9848:9848" - - "9849:9849" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8848/nacos/actuator/health"] + interval: 10s + timeout: 5s + retries: 3 admin: image: shenyu/admin:latest @@ -48,7 +52,11 @@ services: - "9095:9095" depends_on: zookeeper: - condition: service_started + condition: service_healthy + nacos: + condition: service_healthy + mysql: + 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 @@ -70,7 +78,7 @@ services: - shenyu.register.serverLists=http://admin:9095 - com.alipay.sofa.rpc.registry-address=zookeeper://zookeeper:2181 healthcheck: - test: [ "CMD-SHELL", "wget -q -O - http://localhost:28011/sofa/findAll | grep UP || exit 1" ] + test: ["CMD", "nc", "-z", "localhost", "28011"] timeout: 2s retries: 3 start_period: 5s @@ -91,7 +99,7 @@ services: ports: - "9195:9195" depends_on: - admin: + sofa: condition: service_healthy volumes: - ../../target/test-classes/bootstrap-application.yml:/opt/shenyu-bootstrap/conf/application.yml 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 3b0b7eaccb1c..e64ac6cfbb02 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 @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# + version: '2.3' services: @@ -23,6 +23,11 @@ services: restart: always expose: - 2181 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/commands/stat"] + interval: 10s + timeout: 5s + retries: 3 nacos: image: nacos/nacos-server:v2.2.3 @@ -33,10 +38,11 @@ services: - 8848 - 9848 - 9849 - ports: - - "8848:8848" - - "9848:9848" - - "9849:9849" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8848/nacos/actuator/health"] + interval: 10s + timeout: 5s + retries: 3 admin: image: shenyu/admin:latest @@ -87,6 +93,12 @@ services: depends_on: eureka: condition: service_healthy + mysql: + condition: service_healthy + nacos: + condition: service_healthy + zookeeper: + condition: service_healthy healthcheck: test: [ "CMD-SHELL", "wget -q -O - http://springcloud:8884/actuator/health | grep UP || exit 1" ] timeout: 2s