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

zhangzicheng 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 9928752ae [type:optimize] some integration testing optimize (#4753)
9928752ae is described below

commit 9928752ae17457c76b5a7cc4aba22bcc03eb8f00
Author: zhengpeng <[email protected]>
AuthorDate: Wed Jun 21 16:55:07 2023 +0800

    [type:optimize] some integration testing optimize (#4753)
    
    * fix: some optimization
    
    * fix: some optimization
---
 .../http/controller/HttpTestController.java        |  2 +-
 .../shenyu-integrated-test-http/docker-compose.yml |  2 +-
 .../LoggingElasticSearchPluginTest.java            | 29 ++++++++++++++++++++--
 .../shenyu-custom-plugin/pom.xml                   |  4 +--
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git 
a/shenyu-examples/shenyu-examples-http/src/main/java/org/apache/shenyu/examples/http/controller/HttpTestController.java
 
b/shenyu-examples/shenyu-examples-http/src/main/java/org/apache/shenyu/examples/http/controller/HttpTestController.java
index 864d9ce4b..f4044c5d3 100644
--- 
a/shenyu-examples/shenyu-examples-http/src/main/java/org/apache/shenyu/examples/http/controller/HttpTestController.java
+++ 
b/shenyu-examples/shenyu-examples-http/src/main/java/org/apache/shenyu/examples/http/controller/HttpTestController.java
@@ -68,7 +68,7 @@ import java.util.Map;
 @ApiModule("/test")
 public class HttpTestController {
 
-    private static final Integer SIZE = 1024 * 1024;
+    private static final Integer SIZE = 20000;
 
     private static final Logger LOGGER = 
LoggerFactory.getLogger(HttpTestController.class);
 
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-http/docker-compose.yml 
b/shenyu-integrated-test/shenyu-integrated-test-http/docker-compose.yml
index 6811af8f2..5d8d5b8ca 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-http/docker-compose.yml
+++ b/shenyu-integrated-test/shenyu-integrated-test-http/docker-compose.yml
@@ -120,7 +120,7 @@ services:
       - "9200:9200"
       - "9300:9300"
     environment:
-      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
+      - "ES_JAVA_OPTS=-Xms2048m -Xmx2048m"
       - discovery.type=single-node
       - xpack.security.enabled=false
     healthcheck:
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/LoggingElasticSearchPluginTest.java
 
b/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/LoggingElasticSearchPluginTest.java
index 57de72c09..b9768d1c5 100644
--- 
a/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/LoggingElasticSearchPluginTest.java
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/LoggingElasticSearchPluginTest.java
@@ -23,6 +23,11 @@ import co.elastic.clients.json.jackson.JacksonJsonpMapper;
 import co.elastic.clients.transport.ElasticsearchTransport;
 import co.elastic.clients.transport.endpoints.BooleanResponse;
 import co.elastic.clients.transport.rest_client.RestClientTransport;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
 import org.apache.http.HttpHost;
 import org.apache.shenyu.common.dto.ConditionData;
 import org.apache.shenyu.common.enums.OperatorEnum;
@@ -33,10 +38,11 @@ import 
org.apache.shenyu.integratedtest.common.helper.HttpHelper;
 import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
 import org.apache.shenyu.web.controller.LocalPluginController.RuleLocalData;
 import org.elasticsearch.client.RestClient;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -57,6 +63,8 @@ public class LoggingElasticSearchPluginTest extends 
AbstractPluginDataInit {
 
     private static ElasticsearchClient client;
 
+    private static final Logger LOG = 
LoggerFactory.getLogger(LoggingElasticSearchPluginTest.class);
+
     @BeforeAll
     public static void setup() throws IOException {
         String pluginResult = 
initPlugin(PluginEnum.LOGGING_ELASTIC_SEARCH.getName(), 
"{\"host\":\"shenyu-elasticsearch\", \"port\": \"9200\"}");
@@ -69,10 +77,27 @@ public class LoggingElasticSearchPluginTest extends 
AbstractPluginDataInit {
                 .build();
         transport = new RestClientTransport(restClient, new 
JacksonJsonpMapper());
         client = new ElasticsearchClient(transport);
+        OkHttpClient client = new OkHttpClient();
+        MediaType mediaType = MediaType.parse("application/json");
+        RequestBody body = RequestBody.create(mediaType, 
"{\"number_of_replicas\":0}");
+        Request request = new Request.Builder()
+                .url("http://localhost:9200/_settings";)
+                .put(body)
+                .addHeader("Content-Type", "application/json")
+                .addHeader("cache-control", "no-cache")
+                .build();
+        Response response = client.newCall(request).execute();
+        LOG.info("response {},", response.body().string());
+        Request balanceRequest = new Request.Builder()
+                
.url("http://localhost:9200/_cluster/reroute?retry_failed=true";)
+                .post(null)
+                .addHeader("cache-control", "no-cache")
+                .build();
+        Response balanceResponse = client.newCall(balanceRequest).execute();
+        LOG.info("balanceResponse {},", balanceResponse.body().string());
     }
 
     @Test
-    @Disabled
     public void testElasticSearchPlugin() throws Exception {
         String result = 
HttpHelper.INSTANCE.postGateway(LOGGING_ELASTIC_SEARCH_PATH, String.class);
         assertNotNull(result);
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-upload-plugin/shenyu-custom-plugin/pom.xml
 
b/shenyu-integrated-test/shenyu-integrated-test-upload-plugin/shenyu-custom-plugin/pom.xml
index 2f5dd916c..1f5cf6e95 100644
--- 
a/shenyu-integrated-test/shenyu-integrated-test-upload-plugin/shenyu-custom-plugin/pom.xml
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-upload-plugin/shenyu-custom-plugin/pom.xml
@@ -38,13 +38,13 @@
         <dependency>
             <groupId>org.apache.shenyu</groupId>
             <artifactId>shenyu-plugin-api</artifactId>
-            <version>2.5.0</version>
+            <version>${project.version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.shenyu</groupId>
             <artifactId>shenyu-plugin-base</artifactId>
-            <version>2.5.0</version>
+            <version>${project.version}</version>
         </dependency>
     </dependencies>
 

Reply via email to