From eb32555f4b36ae52e0281b455929c60eef14cfab Mon Sep 17 00:00:00 2001 From: 4paradigm <4paradigm@denglong.local> Date: Thu, 30 Nov 2023 09:35:34 +0800 Subject: [PATCH] test: fix online mode --- .../openmldb/jdbc/SQLRouterSmokeTest.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/java/openmldb-jdbc/src/test/java/com/_4paradigm/openmldb/jdbc/SQLRouterSmokeTest.java b/java/openmldb-jdbc/src/test/java/com/_4paradigm/openmldb/jdbc/SQLRouterSmokeTest.java index ecfaba9e430..bc92f20d3f5 100644 --- a/java/openmldb-jdbc/src/test/java/com/_4paradigm/openmldb/jdbc/SQLRouterSmokeTest.java +++ b/java/openmldb-jdbc/src/test/java/com/_4paradigm/openmldb/jdbc/SQLRouterSmokeTest.java @@ -55,11 +55,10 @@ public class SQLRouterSmokeTest { option.setZkCluster(TestConfig.ZK_CLUSTER); option.setSessionTimeout(200000); clusterExecutor = new SqlClusterExecutor(option); + setOnlineMode(clusterExecutor); option.setLight(true); lightClusterExecutor = new SqlClusterExecutor(option); - java.sql.Statement state = clusterExecutor.getStatement(); - state.execute("SET @@execute_mode='online';"); - state.close(); + setOnlineMode(lightClusterExecutor); // create standalone router SdkOption standaloneOption = new SdkOption(); standaloneOption.setHost(TestConfig.HOST); @@ -72,6 +71,16 @@ public class SQLRouterSmokeTest { } } + static void setOnlineMode(SqlExecutor executor) { + java.sql.Statement state = executor.getStatement(); + try { + state.execute("SET @@execute_mode='online';"); + state.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + @Test void testMoreOptions() throws Exception { SdkOption option = new SdkOption(); @@ -131,7 +140,7 @@ public void testSmoke(SqlExecutor router) { // select String select1 = "select * from tsql1010;"; - SQLResultSet rs1 = (SQLResultSet) router .executeSQL(dbname, select1); + SQLResultSet rs1 = (SQLResultSet) router.executeSQL(dbname, select1); Assert.assertEquals(2, rs1.GetInternalSchema().getColumnList().size()); Assert.assertEquals(Types.BIGINT, rs1.GetInternalSchema().getColumnType(0));