Skip to content

Commit 208d547

Browse files
authored
Merge pull request #2146 from ClickHouse/fix_jdbc_tests_switching_db
[jdbc-v2] fixed switching db test
2 parents e37c105 + 804dba1 commit 208d547

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,7 @@ public void testTransactionTimeout() throws ClickHouseException {
25112511

25122512
tx.begin();
25132513
try {
2514-
Thread.sleep(3000L);
2514+
Thread.sleep(4000L);
25152515
} catch (InterruptedException ex) {
25162516
Assert.fail("Sleep was interrupted", ex);
25172517
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,12 +562,13 @@ void testWithClause() throws Exception {
562562

563563
@Test(groups = { "integration" })
564564
public void testSwitchDatabase() throws Exception {
565+
String databaseName = getDatabase() + "_test_switch";
565566
String createSql = "CREATE TABLE switchDatabaseWithUse (id UInt8, words String) ENGINE = MergeTree ORDER BY ()";
566567
try (Connection conn = getJdbcConnection()) {
567568
try (Statement stmt = conn.createStatement()) {
568569
assertEquals(stmt.executeUpdate(createSql), 0);
569-
assertEquals(stmt.executeUpdate("CREATE DATABASE \"newDatabase\" ENGINE=Atomic"), 0);
570-
assertFalse(stmt.execute("USE \"newDatabase\""));
570+
assertEquals(stmt.executeUpdate("CREATE DATABASE \"" + databaseName + "\""), 0);
571+
assertFalse(stmt.execute("USE \"" + databaseName + "\""));
571572
assertEquals(stmt.executeUpdate(createSql), 0);
572573
}
573574
}

0 commit comments

Comments
 (0)