Skip to content

Commit 1299db9

Browse files
committed
Add integration test
1 parent 3ec6042 commit 1299db9

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.sql.ResultSet;
44
import java.sql.SQLException;
5+
import java.sql.Statement;
6+
import java.util.Locale;
57
import java.util.Properties;
68

79
import org.testng.Assert;
@@ -18,4 +20,26 @@ public void testGetTypeInfo() throws SQLException {
1820
}
1921
}
2022
}
23+
24+
@Test(groups = "integration")
25+
public void testTableComment() throws SQLException {
26+
String tableName = "test_table_comment";
27+
String tableComment = "table comments";
28+
try (ClickHouseConnection conn = newConnection(new Properties());
29+
Statement s = conn.createStatement()) {
30+
// https://github.com/ClickHouse/ClickHouse/pull/30852
31+
if (!conn.getServerVersion().check("[21.6,)")) {
32+
return;
33+
}
34+
35+
s.execute(String.format(Locale.ROOT,
36+
"drop table if exists %1$s; create table %1$s(s String) engine=Memory comment '%2$s'",
37+
tableName, tableComment));
38+
try (ResultSet rs = conn.getMetaData().getTables(null, "%", tableName, null)) {
39+
Assert.assertTrue(rs.next());
40+
Assert.assertEquals(rs.getString("remarks"), tableComment);
41+
Assert.assertFalse(rs.next());
42+
}
43+
}
44+
}
2145
}

0 commit comments

Comments
 (0)