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/11/14 10:08:03 UTC

[iotdb] 02/02: add tset case

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

hxd pushed a commit to branch fix_session_pool_for_0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d4b5439d332fdf213117dd20db88f81d2902bf6f
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Sat Nov 14 18:03:47 2020 +0800

    add tset case
---
 .../org/apache/iotdb/session/pool/SessionPoolTest.java    | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

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 fbca8e4..c426e90 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
@@ -33,6 +33,7 @@ import org.apache.iotdb.rpc.IoTDBConnectionException;
 import org.apache.iotdb.rpc.StatementExecutionException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -240,8 +241,18 @@ public class SessionPoolTest {
   @Test
   public void testClose() {
     SessionPool pool = new SessionPool("127.0.0.1", 6667, "root", "root", 3, 1, 60000, false, null);
-    write10Data(pool, true);
-
+    pool.close();
+    try {
+      pool.insertRecord("root.sg1.d1", 1, Collections.singletonList("s1" ),
+          Collections.singletonList(TSDataType.INT64),
+          Collections.singletonList(1L));
+    } catch (IoTDBConnectionException e) {
+      Assert.assertEquals("Session pool is closed", e.getMessage());
+    } catch (StatementExecutionException e) {
+      fail();
+    }
+    //some other test cases are not covered:
+    //e.g., thread A created a new session, but not returned; thread B close the pool; A get the session.
   }
 
 }
\ No newline at end of file