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 2021/05/07 10:45:07 UTC

[iotdb] branch test_container updated: add issue 1348 test

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

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


The following commit(s) were added to refs/heads/test_container by this push:
     new 4f76062  add issue 1348 test
4f76062 is described below

commit 4f76062de792654f2fe13bf6d3b3a2ff45c731fa
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Fri May 7 18:44:37 2021 +0800

    add issue 1348 test
---
 .../test/java/org/apache/iotdb/db/sql/Cases.java   | 20 +++++++++++++++++++
 .../java/org/apache/iotdb/db/sql/ClusterIT.java    |  4 ++++
 .../java/org/apache/iotdb/db/sql/SingleNodeIT.java | 23 ++--------------------
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/testcontainer/src/test/java/org/apache/iotdb/db/sql/Cases.java b/testcontainer/src/test/java/org/apache/iotdb/db/sql/Cases.java
index 45ed42c..fed6a1e 100644
--- a/testcontainer/src/test/java/org/apache/iotdb/db/sql/Cases.java
+++ b/testcontainer/src/test/java/org/apache/iotdb/db/sql/Cases.java
@@ -100,5 +100,25 @@ public abstract class Cases {
       Assert.assertFalse(resultSet.next());
       resultSet.close();
     }
+
+    // test https://issues.apache.org/jira/browse/IOTDB-1348
+    initDataArray =
+        new String[] {
+          "INSERT INTO root.ln.wf01.wt01(timestamp, temperature) values(250, 10.0)",
+          "INSERT INTO root.ln.wf01.wt01(timestamp, temperature) values(300, 20.0)",
+          "INSERT INTO root.ln.wf01.wt01(timestamp, temperature) values(350, 25.0)"
+        };
+
+    for (String initData : initDataArray) {
+      writeStatement.execute(initData);
+    }
+    // try to read data on each node.
+    for (Statement readStatement : readStatements) {
+      resultSet = readStatement.executeQuery("select last * from root.ln.wf01.wt01;");
+      Assert.assertTrue(resultSet.next());
+      double last = Double.parseDouble(resultSet.getString(3));
+      Assert.assertEquals(25.0, last, 0.1);
+      resultSet.close();
+    }
   }
 }
diff --git a/testcontainer/src/test/java/org/apache/iotdb/db/sql/ClusterIT.java b/testcontainer/src/test/java/org/apache/iotdb/db/sql/ClusterIT.java
index c90f5c4..9345851 100644
--- a/testcontainer/src/test/java/org/apache/iotdb/db/sql/ClusterIT.java
+++ b/testcontainer/src/test/java/org/apache/iotdb/db/sql/ClusterIT.java
@@ -87,4 +87,8 @@ public abstract class ClusterIT extends Cases {
   public void tearDown() throws Exception {
     super.tearDown();
   }
+
+  // do not add tests here.
+  // add tests into Cases.java instead.
+
 }
diff --git a/testcontainer/src/test/java/org/apache/iotdb/db/sql/SingleNodeIT.java b/testcontainer/src/test/java/org/apache/iotdb/db/sql/SingleNodeIT.java
index a6246d2..5ca7dca 100644
--- a/testcontainer/src/test/java/org/apache/iotdb/db/sql/SingleNodeIT.java
+++ b/testcontainer/src/test/java/org/apache/iotdb/db/sql/SingleNodeIT.java
@@ -76,25 +76,6 @@ public class SingleNodeIT extends Cases {
     super.tearDown();
   }
 
-  @Test
-  public void testAgg() throws SQLException {
-
-    String[] timeSeriesArray = {"root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE"};
-    String[] initDataArray = {
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature) values(200,20.71)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature) values(220,50.71)"
-    };
-
-    for (String timeSeries : timeSeriesArray) {
-      statement.execute(String.format("create timeseries %s ", timeSeries));
-    }
-    for (String initData : initDataArray) {
-      statement.execute(initData);
-    }
-    ResultSet resultSet = statement.executeQuery("select avg(temperature) from root.ln.wf01.wt01;");
-    Assert.assertTrue(resultSet.next());
-    double avg = resultSet.getDouble(1);
-    Assert.assertEquals(35.71, avg, 0.1);
-    resultSet.close();
-  }
+  // do not add tests here.
+  // add tests into Cases.java instead.
 }