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

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


The following commit(s) were added to refs/heads/master by this push:
     new 13c047fe7bc IT: enable REST service when needed to fix IT (#11726)
13c047fe7bc is described below

commit 13c047fe7bcb4226883b6c5bc6b93541dcdb8757
Author: CloudWise-Lukemiao 
<[email protected]>
AuthorDate: Fri Dec 15 15:51:08 2023 +0800

    IT: enable REST service when needed to fix IT (#11726)
    
    Co-authored-by: luke.miao <[email protected]>
---
 .../java/org/apache/iotdb/it/env/cluster/ClusterConstant.java    | 5 -----
 .../apache/iotdb/it/env/cluster/config/MppDataNodeConfig.java    | 6 ++++++
 .../org/apache/iotdb/it/env/cluster/node/DataNodeWrapper.java    | 9 ---------
 .../apache/iotdb/it/env/remote/config/RemoteDataNodeConfig.java  | 5 +++++
 .../main/java/org/apache/iotdb/itbase/env/DataNodeConfig.java    | 2 ++
 .../test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java    | 5 ++++-
 .../src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java | 6 ++++--
 7 files changed, 21 insertions(+), 17 deletions(-)

diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ClusterConstant.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ClusterConstant.java
index ac4ca94ca57..6cf9fb71c1c 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ClusterConstant.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/ClusterConstant.java
@@ -139,11 +139,6 @@ public class ClusterConstant {
   public static final String TRIGGER_LIB_DIR = "trigger_lib_dir";
   public static final String PIPE_LIB_DIR = "pipe_lib_dir";
   public static final String REST_SERVICE_PORT = "rest_service_port";
-  public static final String ENABLE_REST_SERVICE = "enable_rest_service";
-  public static final String ENABLE_SWAGGER = "enable_swagger";
-  public static final String REST_QUERY_DEFAULT_ROW_SIZE_LIMIT =
-      "rest_query_default_row_size_limit";
-  public static final String CACHE_EXPIRE_IN_SECONDS = 
"cache_expire_in_seconds";
   public static final String INFLUXDB_RPC_PORT = "influxdb_rpc_port";
 
   // ConfigNode
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppDataNodeConfig.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppDataNodeConfig.java
index 75f1821a93c..9c474032367 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppDataNodeConfig.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppDataNodeConfig.java
@@ -55,4 +55,10 @@ public class MppDataNodeConfig extends MppBaseConfig 
implements DataNodeConfig {
     properties.setProperty("dn_metric_reporter_list", String.join(",", 
metricReporterTypes));
     return this;
   }
+
+  @Override
+  public DataNodeConfig setEnableRestService(boolean enableRestService) {
+    properties.setProperty("enable_rest_service", 
String.valueOf(enableRestService));
+    return this;
+  }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/DataNodeWrapper.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/DataNodeWrapper.java
index e62f11de718..e6d16f9860b 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/DataNodeWrapper.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/DataNodeWrapper.java
@@ -29,7 +29,6 @@ import java.util.Arrays;
 import java.util.List;
 
 import static org.apache.iotdb.consensus.ConsensusFactory.SIMPLE_CONSENSUS;
-import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.CACHE_EXPIRE_IN_SECONDS;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.COMMON_PROPERTIES_FILE;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.CONFIG_NODE_CONSENSUS_PROTOCOL_CLASS;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.DATANODE_INIT_HEAP_SIZE;
@@ -54,15 +53,12 @@ import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.DN_SYNC_DIR;
 import static org.apache.iotdb.it.env.cluster.ClusterConstant.DN_SYSTEM_DIR;
 import static org.apache.iotdb.it.env.cluster.ClusterConstant.DN_TRACING_DIR;
 import static org.apache.iotdb.it.env.cluster.ClusterConstant.DN_WAL_DIRS;
-import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.ENABLE_REST_SERVICE;
-import static org.apache.iotdb.it.env.cluster.ClusterConstant.ENABLE_SWAGGER;
 import static org.apache.iotdb.it.env.cluster.ClusterConstant.MAIN_CLASS_NAME;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.MAX_TSBLOCK_SIZE_IN_BYTES;
 import static org.apache.iotdb.it.env.cluster.ClusterConstant.MQTT_HOST;
 import static org.apache.iotdb.it.env.cluster.ClusterConstant.MQTT_PORT;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.PAGE_SIZE_IN_BYTE;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.PIPE_AIR_GAP_RECEIVER_PORT;
-import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.REST_QUERY_DEFAULT_ROW_SIZE_LIMIT;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.REST_SERVICE_PORT;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.SCHEMA_REGION_CONSENSUS_PROTOCOL_CLASS;
 import static 
org.apache.iotdb.it.env.cluster.ClusterConstant.SCHEMA_REPLICATION_FACTOR;
@@ -116,10 +112,6 @@ public class DataNodeWrapper extends AbstractNodeWrapper {
         PIPE_AIR_GAP_RECEIVER_PORT, 
String.valueOf(this.pipeAirGapReceiverPort));
 
     immutableNodeProperties.setProperty(REST_SERVICE_PORT, 
String.valueOf(restServicePort));
-    immutableNodeProperties.setProperty(ENABLE_REST_SERVICE, "true");
-    immutableNodeProperties.setProperty(ENABLE_SWAGGER, "false");
-    immutableNodeProperties.setProperty(REST_QUERY_DEFAULT_ROW_SIZE_LIMIT, 
"10000");
-    immutableNodeProperties.setProperty(CACHE_EXPIRE_IN_SECONDS, "28800");
 
     immutableNodeProperties.setProperty(IoTDBConstant.DN_SEED_CONFIG_NODE, 
seedConfigNode);
     immutableNodeProperties.setProperty(DN_SYSTEM_DIR, 
MppBaseConfig.NULL_VALUE);
@@ -195,7 +187,6 @@ public class DataNodeWrapper extends AbstractNodeWrapper {
     mutableCommonProperties.setProperty(SCHEMA_REPLICATION_FACTOR, "1");
     mutableCommonProperties.setProperty(DATA_REPLICATION_FACTOR, "1");
 
-    mutableNodeProperties.put(ENABLE_REST_SERVICE, "true");
     mutableNodeProperties.put(REST_SERVICE_PORT, 
String.valueOf(this.restServicePort));
 
     mutableCommonProperties.put(MAX_TSBLOCK_SIZE_IN_BYTES, "1024");
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteDataNodeConfig.java
 
b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteDataNodeConfig.java
index 6bb6cfbcef4..9c1cb692b26 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteDataNodeConfig.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteDataNodeConfig.java
@@ -27,4 +27,9 @@ public class RemoteDataNodeConfig implements DataNodeConfig {
   public DataNodeConfig setMetricReporterType(List<String> 
metricReporterTypes) {
     return this;
   }
+
+  @Override
+  public DataNodeConfig setEnableRestService(boolean enableRestService) {
+    return this;
+  }
 }
diff --git 
a/integration-test/src/main/java/org/apache/iotdb/itbase/env/DataNodeConfig.java
 
b/integration-test/src/main/java/org/apache/iotdb/itbase/env/DataNodeConfig.java
index 2778160d4d9..b1f3b51c265 100644
--- 
a/integration-test/src/main/java/org/apache/iotdb/itbase/env/DataNodeConfig.java
+++ 
b/integration-test/src/main/java/org/apache/iotdb/itbase/env/DataNodeConfig.java
@@ -24,4 +24,6 @@ import java.util.List;
 /** This interface is used to handle properties in iotdb-datanode.properties. 
*/
 public interface DataNodeConfig {
   DataNodeConfig setMetricReporterType(List<String> metricReporterTypes);
+
+  DataNodeConfig setEnableRestService(boolean enableRestService);
 }
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java
index d52b0b64351..ee0ee073c96 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/GrafanaApiServiceIT.java
@@ -24,6 +24,7 @@ import org.apache.iotdb.it.framework.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
 import org.apache.iotdb.itbase.category.LocalStandaloneIT;
 import org.apache.iotdb.itbase.category.RemoteIT;
+import org.apache.iotdb.itbase.env.BaseEnv;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.JsonObject;
@@ -62,7 +63,9 @@ public class GrafanaApiServiceIT {
 
   @Before
   public void setUp() throws Exception {
-    EnvFactory.getEnv().initClusterEnvironment();
+    BaseEnv baseEnv = EnvFactory.getEnv();
+    baseEnv.getConfig().getDataNodeConfig().setEnableRestService(true);
+    baseEnv.initClusterEnvironment();
     DataNodeWrapper portConflictDataNodeWrapper = 
EnvFactory.getEnv().getDataNodeWrapper(0);
     port = portConflictDataNodeWrapper.getRestServicePort();
   }
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java
index 4b711b01874..2db9f708c5c 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java
@@ -24,6 +24,7 @@ import org.apache.iotdb.it.framework.IoTDBTestRunner;
 import org.apache.iotdb.itbase.category.ClusterIT;
 import org.apache.iotdb.itbase.category.LocalStandaloneIT;
 import org.apache.iotdb.itbase.category.RemoteIT;
+import org.apache.iotdb.itbase.env.BaseEnv;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.JsonObject;
@@ -63,8 +64,9 @@ public class IoTDBRestServiceIT {
 
   @Before
   public void setUp() throws Exception {
-
-    EnvFactory.getEnv().initClusterEnvironment();
+    BaseEnv baseEnv = EnvFactory.getEnv();
+    baseEnv.getConfig().getDataNodeConfig().setEnableRestService(true);
+    baseEnv.initClusterEnvironment();
     DataNodeWrapper portConflictDataNodeWrapper = 
EnvFactory.getEnv().getDataNodeWrapper(0);
     port = portConflictDataNodeWrapper.getRestServicePort();
   }

Reply via email to