Skip to content

Commit 7ec63e6

Browse files
committed
added test verifying that setQueryTimeout() is working with ASYNC operations
1 parent d48781e commit 7ec63e6

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

jdbc-v2/src/test/java/com/clickhouse/jdbc/PreparedStatementTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.clickhouse.jdbc;
22

3+
import com.clickhouse.client.api.ClientConfigProperties;
34
import com.clickhouse.client.api.DataTypeUtils;
45
import com.clickhouse.data.ClickHouseColumn;
56
import com.clickhouse.data.ClickHouseDataType;
@@ -566,6 +567,18 @@ void testSelectFromArray() throws Exception {
566567
}
567568
}
568569

570+
@Test(groups = {"integration"})
571+
void testExecuteQueryTimeout() throws Exception {
572+
final String sql = "SELECT sum(reinterpretAsUInt64(MD5(toString(number)))) FROM system.numbers LIMIT 1000000";
573+
Properties config = new Properties();
574+
config.setProperty(ClientConfigProperties.ASYNC_OPERATIONS.getKey(), "true");
575+
try (Connection conn = getJdbcConnection(config);
576+
PreparedStatement stmt = conn.prepareStatement(sql)) {
577+
stmt.setQueryTimeout(1);
578+
assertThrows(SQLException.class, stmt::executeQuery);
579+
}
580+
}
581+
569582
@Test(groups = { "integration" })
570583
void testInsert() throws Exception {
571584
int ROWS = 1000;

0 commit comments

Comments
 (0)