Skip to content

Commit 4db60e8

Browse files
committed
Skip tx related gRPC tests in 23.3 and above
1 parent 32f39a9 commit 4db60e8

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/ClickHouseConnectionTest.java

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import java.util.Properties;
1010
import java.util.UUID;
1111

12+
import com.clickhouse.client.ClickHouseProtocol;
13+
import com.clickhouse.client.ClickHouseRequest;
1214
import com.clickhouse.client.config.ClickHouseClientOption;
1315
import com.clickhouse.data.ClickHouseCompression;
1416
import com.clickhouse.data.ClickHouseUtils;
@@ -28,7 +30,15 @@ public ClickHouseConnection newConnection(Properties properties) throws SQLExcep
2830
public void testCentralizedConfiguration() throws SQLException {
2931
Properties props = new Properties();
3032
props.setProperty("custom_settings", "max_result_rows=1");
31-
try (ClickHouseConnection conn = newConnection(props)) {
33+
try (ClickHouseConnection conn = newConnection(props); Statement stmt = conn.createStatement()) {
34+
// gRPC stopped working since 23.3 with below error:
35+
// SQL Code: 649, DB::Exception: Transaction Control Language queries are
36+
// allowed only inside session: while starting a transaction with
37+
// 'implicit_transaction'
38+
if (stmt.unwrap(ClickHouseRequest.class).getServer().getProtocol() == ClickHouseProtocol.GRPC) {
39+
throw new SkipException("Skip the test as transaction is supported since 22.7");
40+
}
41+
3242
Assert.assertEquals(conn.getConfig().getResponseCompressAlgorithm(), ClickHouseCompression.LZ4);
3343
Assert.assertTrue(conn.getJdbcConfig().isAutoCommit());
3444
Assert.assertFalse(conn.getJdbcConfig().isTransactionSupported());
@@ -121,7 +131,12 @@ public void testAutoCommitMode() throws SQLException {
121131

122132
for (int i = 0; i < 10; i++) {
123133
try (ClickHouseConnection conn = newConnection(props); Statement stmt = conn.createStatement()) {
124-
if (!conn.getServerVersion().check("[22.7,)")) {
134+
if (!conn.getServerVersion().check("[22.7,)")
135+
// gRPC stopped working since 23.3 with below error:
136+
// SQL Code: 649, DB::Exception: Transaction Control Language queries are
137+
// allowed only inside session: while starting a transaction with
138+
// 'implicit_transaction'
139+
|| stmt.unwrap(ClickHouseRequest.class).getServer().getProtocol() == ClickHouseProtocol.GRPC) {
125140
throw new SkipException("Skip the test as transaction is supported since 22.7");
126141
}
127142
stmt.execute("select 1, throwIf(" + i + " % 3 = 0)");
@@ -292,7 +307,12 @@ public void testAutoCommit() throws SQLException {
292307
props.setProperty("transactionSupport", "true");
293308
String tableName = "test_jdbc_tx_auto_commit";
294309
try (ClickHouseConnection c = newConnection(props); Statement s = c.createStatement()) {
295-
if (!c.getServerVersion().check("[22.7,)")) {
310+
if (!c.getServerVersion().check("[22.7,)")
311+
// gRPC stopped working since 23.3 with below error:
312+
// SQL Code: 649, DB::Exception: Transaction Control Language queries are
313+
// allowed only inside session: while starting a transaction with
314+
// 'implicit_transaction'
315+
|| s.unwrap(ClickHouseRequest.class).getServer().getProtocol() == ClickHouseProtocol.GRPC) {
296316
throw new SkipException("Skip the test as transaction is supported since 22.7");
297317
}
298318
s.execute("drop table if exists " + tableName + "; "
@@ -385,7 +405,12 @@ public void testManualTxApi() throws SQLException {
385405
txProps.setProperty("transactionSupport", "true");
386406
String tableName = "test_jdbc_manual_tx_api";
387407
try (ClickHouseConnection c = newConnection(txProps); Statement s = c.createStatement()) {
388-
if (!c.getServerVersion().check("[22.7,)")) {
408+
if (!c.getServerVersion().check("[22.7,)")
409+
// gRPC stopped working since 23.3 with below error:
410+
// SQL Code: 649, DB::Exception: Transaction Control Language queries are
411+
// allowed only inside session: while starting a transaction with
412+
// 'implicit_transaction'
413+
|| s.unwrap(ClickHouseRequest.class).getServer().getProtocol() == ClickHouseProtocol.GRPC) {
389414
throw new SkipException("Skip the test as transaction is supported since 22.7");
390415
}
391416
s.execute("drop table if exists " + tableName + "; "
@@ -496,7 +521,12 @@ public void testManualTxTcl() throws SQLException {
496521
txProps.setProperty("transactionSupport", "true");
497522
String tableName = "test_jdbc_manual_tx_tcl";
498523
try (ClickHouseConnection c = newConnection(txProps); Statement s = c.createStatement()) {
499-
if (!c.getServerVersion().check("[22.7,)")) {
524+
if (!c.getServerVersion().check("[22.7,)")
525+
// gRPC stopped working since 23.3 with below error:
526+
// SQL Code: 649, DB::Exception: Transaction Control Language queries are
527+
// allowed only inside session: while starting a transaction with
528+
// 'implicit_transaction'
529+
|| s.unwrap(ClickHouseRequest.class).getServer().getProtocol() == ClickHouseProtocol.GRPC) {
500530
throw new SkipException("Skip the test as transaction is supported since 22.7");
501531
}
502532
s.execute("drop table if exists " + tableName + "; "

0 commit comments

Comments
 (0)