Skip to content

Commit

Permalink
test: fix online mode
Browse files Browse the repository at this point in the history
  • Loading branch information
4paradigm committed Nov 30, 2023
1 parent d404b2b commit eb32555
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit eb32555

Please sign in to comment.