You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2020/02/18 04:29:35 UTC

[incubator-iotdb] branch ut_close_socket updated: fix two daemon conflict in IoTDBRecoverIT

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

hxd pushed a commit to branch ut_close_socket
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/ut_close_socket by this push:
     new 46643be  fix two daemon conflict in IoTDBRecoverIT
46643be is described below

commit 46643be08679a1081091394ad8ecb1e6a67d3d28
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Tue Feb 18 12:29:15 2020 +0800

    fix two daemon conflict in IoTDBRecoverIT
---
 .../iotdb/db/integration/IoTDBRecoverIT.java       |  8 +++-----
 .../apache/iotdb/db/utils/EnvironmentUtils.java    | 24 +++++++++++++++-------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBRecoverIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBRecoverIT.java
index 301cf62..a06a0cc 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBRecoverIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBRecoverIT.java
@@ -83,15 +83,13 @@ public class IoTDBRecoverIT {
   public void setUp() throws Exception {
     EnvironmentUtils.closeStatMonitor();
     daemon = IoTDB.getInstance();
-    daemon.active();
-    EnvironmentUtils.envSetUp();
+    EnvironmentUtils.envSetUp(daemon);
     Class.forName(Config.JDBC_DRIVER_NAME);
     prepareData();
   }
 
   @After
   public void tearDown() throws Exception {
-    daemon.stop();
     EnvironmentUtils.cleanEnv();
   }
 
@@ -164,7 +162,7 @@ public class IoTDBRecoverIT {
       e.printStackTrace();
     }
     daemon.active();
-    EnvironmentUtils.envSetUp();
+    //EnvironmentUtils.envSetUp();
 
     // count test
     retArray = new String[]{
@@ -219,7 +217,7 @@ public class IoTDBRecoverIT {
       e.printStackTrace();
     }
     daemon.active();
-    EnvironmentUtils.envSetUp();
+    //EnvironmentUtils.envSetUp();
 
     // maxminValueTest
 
diff --git a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
index 256ee89..f1f189b 100644
--- a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
@@ -186,15 +186,25 @@ public class EnvironmentUtils {
    * disable memory control</br> this function should be called before all code in the setup
    */
   public static void envSetUp() throws StartupException {
+    envSetUp(daemon);
+  }
+
+  /**
+   * disable memory control</br> this function should be called before all code in the setup
+   * <br> the caller should not call daemon.active(). This method will call the active() method.
+   */
+  public static void envSetUp(IoTDB daemon) throws StartupException {
     System.setProperty(IoTDBConstant.REMOTE_JMX_PORT_NAME, "31999");
     IoTDBDescriptor.getInstance().getConfig().setThriftServerAwaitTimeForStopService(0);
     if (daemon == null) {
-      daemon = new IoTDB();
-      try {
-        daemon.active();
-      } catch (Exception e) {
-        fail(e.getMessage());
-      }
+      EnvironmentUtils.daemon = new IoTDB();
+    } else {
+      EnvironmentUtils.daemon = daemon;
+    }
+    try {
+      EnvironmentUtils.daemon.active();
+    } catch (Exception e) {
+      fail(e.getMessage());
     }
 
     IoTDBDescriptor.getInstance().getConfig().setEnableParameterAdapter(false);
@@ -203,7 +213,7 @@ public class EnvironmentUtils {
     createAllDir();
     // disable the system monitor
     config.setEnableStatMonitor(false);
-    TEST_QUERY_JOB_ID  = QueryResourceManager.getInstance().assignQueryId(true);
+    TEST_QUERY_JOB_ID = QueryResourceManager.getInstance().assignQueryId(true);
     TEST_QUERY_CONTEXT = new QueryContext(TEST_QUERY_JOB_ID);
   }