You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ne...@apache.org on 2021/05/13 04:08:44 UTC

[iotdb] 02/03: fix the UT in SessionPoolTest

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

neuyilan pushed a commit to branch song_thrift_0.14.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 444c89ff3b25d4bbd72570136fe057f3461cc9ae
Author: HouliangQi <ne...@163.com>
AuthorDate: Thu May 13 11:52:14 2021 +0800

    fix the UT in SessionPoolTest
---
 .../apache/iotdb/session/pool/SessionPoolTest.java | 17 +++++++-
 session/src/test/resources/logback.xml             | 47 ++++++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java b/session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java
index 28e2a73..623816e 100644
--- a/session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java
+++ b/session/src/test/java/org/apache/iotdb/session/pool/SessionPoolTest.java
@@ -224,7 +224,22 @@ public class SessionPoolTest {
       pool.close();
       return;
     } catch (StatementExecutionException e) {
-      fail("should be TTransportException but get an exception: " + e.getMessage());
+      // I do not why? the first call wrapper.hasNext() will cause InterruptedException and IoTDB warps
+      // it as StatementExecutionException, the second call can make sure that the thrift server's
+      // connection is closed.
+      try{
+        while (wrapper.hasNext()) {
+          wrapper.next();
+        }
+      } catch (IoTDBConnectionException ec){
+        pool.closeResultSet(wrapper);
+        EnvironmentUtils.reactiveDaemon();
+        correctQuery(pool);
+        pool.close();
+      } catch (StatementExecutionException es) {
+        fail("should be TTransportException but get an exception: " + e.getMessage());
+      }
+      return;
     }
     fail("should throw exception but not");
   }
diff --git a/session/src/test/resources/logback.xml b/session/src/test/resources/logback.xml
new file mode 100644
index 0000000..2709f11
--- /dev/null
+++ b/session/src/test/resources/logback.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<configuration debug="false">
+    <property name="LOG_PATH" value="target/logs"/>
+    <!-- prevent logback from outputting its own status at the start of every log -->
+    <statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
+    <appender class="ch.qos.logback.core.ConsoleAppender" name="stdout">
+        <Target>System.out</Target>
+        <encoder>
+            <pattern>%-5p [%d] [%thread] %C:%L - %m %n</pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>DEBUG</level>
+        </filter>
+    </appender>
+    <!--<logger name="org.apache.iotdb.db.utils.OpenFileNumUtil" level="debug" />-->
+    <!--<logger name="org.apache.iotdb.db.utils.OpenFileNumUtilTest" level="debug" />-->
+    <!-- do not print "Can't get the cpu ratio,because this OS:mac os x is not support in test"-->
+    <logger name="org.apache.iotdb.db.metrics.server.ServerArgument" level="ERROR"/>
+    <!-- enable me if you want to monitor when files are opened and closed.
+    <logger name="FileMonitor" level="info"/>
+    -->
+    <logger name="org.apache.iotdb.session" level="INFO"/>
+    <root level="WARN">
+        <appender-ref ref="stdout"/>
+    </root>
+</configuration>