This is an automated email from the ASF dual-hosted git repository. hui pushed a commit to branch lmh/addQueryIT in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 24777acae1797fbfcaf5c167b9dbcac29fc4578f Author: Minghui Liu <[email protected]> AuthorDate: Fri Jun 17 14:08:47 2022 +0800 move IoTDBLimitSlimitIT & IoTDBPathNumOverLimitIT to newIT --- .../org/apache/iotdb/itbase/env/BaseConfig.java | 4 ++ .../iotdb/db/it/query/IoTDBPaginationIT.java | 50 +++++++++++---- .../db/integration/IoTDBPathNumOverLimitIT.java | 74 ---------------------- 3 files changed, 42 insertions(+), 86 deletions(-) diff --git a/integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseConfig.java b/integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseConfig.java index 6d35f50993..e508a4b533 100644 --- a/integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseConfig.java +++ b/integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseConfig.java @@ -153,4 +153,8 @@ public interface BaseConfig { default String getFlushCommand() { return "flush"; } + + default int getMaxQueryDeduplicatedPathNum() { + return 1000; + } } diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLimitSlimitIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBPaginationIT.java similarity index 83% rename from integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLimitSlimitIT.java rename to integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBPaginationIT.java index a2025316a2..06470399ce 100644 --- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLimitSlimitIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBPaginationIT.java @@ -16,13 +16,15 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.iotdb.db.integration; + +package org.apache.iotdb.db.it.query; import org.apache.iotdb.db.constant.TestConstant; -import org.apache.iotdb.integration.env.EnvFactory; -import org.apache.iotdb.itbase.category.ClusterTest; -import org.apache.iotdb.itbase.category.LocalStandaloneTest; -import org.apache.iotdb.itbase.category.RemoteTest; +import org.apache.iotdb.it.env.ConfigFactory; +import org.apache.iotdb.it.env.EnvFactory; +import org.apache.iotdb.it.env.IoTDBTestRunner; +import org.apache.iotdb.itbase.category.ClusterIT; +import org.apache.iotdb.itbase.category.LocalStandaloneIT; import org.apache.iotdb.jdbc.IoTDBDatabaseMetadata; import org.junit.AfterClass; @@ -30,23 +32,23 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; import java.sql.Connection; import java.sql.DatabaseMetaData; +import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -/** - * Notice that, all test begins with "IoTDB" is integration test. All test which will start the - * IoTDB server should be defined as integration test. - */ -@Category({LocalStandaloneTest.class, ClusterTest.class, RemoteTest.class}) -public class IoTDBLimitSlimitIT { +@RunWith(IoTDBTestRunner.class) +@Category({LocalStandaloneIT.class, ClusterIT.class}) +public class IoTDBPaginationIT { - private static String[] insertSqls = + private static final String[] insertSqls = new String[] { "SET STORAGE GROUP TO root.vehicle", "CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE", @@ -201,4 +203,28 @@ public class IoTDBLimitSlimitIT { e.printStackTrace(); } } + + /** Test path num over limit, there is supposed to throw pathNumOverLimitException. */ + @Test + public void pathNumOverLimitTest() { + final int maxQueryDeduplicatedPathNum = + ConfigFactory.getConfig().getMaxQueryDeduplicatedPathNum(); + ConfigFactory.getConfig().setMaxQueryDeduplicatedPathNum(2); + try (Connection connection = + DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root"); + Statement statement = connection.createStatement()) { + + statement.execute("insert into root.sg.d1(time, s1, s2, s3) values(1, 1, 1, 1)"); + + // fail + statement.execute("select ** from root"); + fail(); + } catch (Exception e) { + assertTrue( + e.getMessage() + .contains( + "Too many paths in one query! Currently allowed max deduplicated path number is 2.")); + } + ConfigFactory.getConfig().setMaxQueryDeduplicatedPathNum(maxQueryDeduplicatedPathNum); + } } diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBPathNumOverLimitIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBPathNumOverLimitIT.java deleted file mode 100644 index 336062aa8d..0000000000 --- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBPathNumOverLimitIT.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -package org.apache.iotdb.db.integration; - -import org.apache.iotdb.db.conf.IoTDBDescriptor; -import org.apache.iotdb.db.utils.EnvironmentUtils; -import org.apache.iotdb.itbase.category.LocalStandaloneTest; -import org.apache.iotdb.jdbc.Config; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.Statement; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -@Category({LocalStandaloneTest.class}) -public class IoTDBPathNumOverLimitIT { - - @Before - public void setUp() throws Exception { - EnvironmentUtils.envSetUp(); - Class.forName(Config.JDBC_DRIVER_NAME); - IoTDBDescriptor.getInstance().getConfig().setMaxQueryDeduplicatedPathNum(2); - } - - @After - public void tearDown() throws Exception { - EnvironmentUtils.cleanEnv(); - IoTDBDescriptor.getInstance().getConfig().setMaxQueryDeduplicatedPathNum(1000); - } - - /** Test path num over limit, there is supposed to throw pathNumOverLimitException. */ - @Test - public void pathNumOverLimitTest() { - try (Connection connection = - DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root"); - Statement statement = connection.createStatement()) { - - statement.execute("insert into root.sg.d1(time, s1, s2, s3) values(1, 1, 1, 1)"); - - // fail - statement.execute("select ** from root"); - fail(); - } catch (Exception e) { - assertTrue( - e.getMessage() - .contains( - "Too many paths in one query! Currently allowed max deduplicated path number is 2.")); - } - } -}
