Skip to content

Commit 9873a5d

Browse files
author
Paultagoras
committed
Update InsertTests.java
1 parent 75d1a9a commit 9873a5d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

client-v2/src/test/java/com/clickhouse/client/insert/InsertTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ private void createTable(String tableQuery) throws ClickHouseException {
5353
}
5454
}
5555

56+
private void dropTable(String tableName) throws ClickHouseException {
57+
try (ClickHouseClient client = ClickHouseClient.builder().config(new ClickHouseConfig())
58+
.nodeSelector(ClickHouseNodeSelector.of(ClickHouseProtocol.HTTP))
59+
.build()) {
60+
String tableQuery = "DROP TABLE IF EXISTS " + tableName;
61+
client.read(getServer(ClickHouseProtocol.HTTP)).query(tableQuery).executeAndWait().close();
62+
}
63+
}
64+
5665
@Test(groups = { "integration" }, enabled = true)
5766
public void insertSimplePOJOs() throws Exception {
5867
String tableName = "simple_pojo_table";
@@ -76,5 +85,6 @@ public void insertSimplePOJOs() throws Exception {
7685
assertTrue(metrics.getMetric(ClientMetrics.OP_SERIALIZATION).getLong() > 0);
7786
assertEquals(metrics.getQueryId(), uuid);
7887
assertEquals(response.getQueryId(), uuid);
88+
dropTable(tableName);
7989
}
8090
}

0 commit comments

Comments
 (0)