From 9873a5d6b181ab382c96c792d438ebccf27dc05a Mon Sep 17 00:00:00 2001 From: Paultagoras Date: Sun, 23 Jun 2024 21:50:54 -0400 Subject: [PATCH] Update InsertTests.java --- .../java/com/clickhouse/client/insert/InsertTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client-v2/src/test/java/com/clickhouse/client/insert/InsertTests.java b/client-v2/src/test/java/com/clickhouse/client/insert/InsertTests.java index a192f8ae2..9fe2286b2 100644 --- a/client-v2/src/test/java/com/clickhouse/client/insert/InsertTests.java +++ b/client-v2/src/test/java/com/clickhouse/client/insert/InsertTests.java @@ -53,6 +53,15 @@ private void createTable(String tableQuery) throws ClickHouseException { } } + private void dropTable(String tableName) throws ClickHouseException { + try (ClickHouseClient client = ClickHouseClient.builder().config(new ClickHouseConfig()) + .nodeSelector(ClickHouseNodeSelector.of(ClickHouseProtocol.HTTP)) + .build()) { + String tableQuery = "DROP TABLE IF EXISTS " + tableName; + client.read(getServer(ClickHouseProtocol.HTTP)).query(tableQuery).executeAndWait().close(); + } + } + @Test(groups = { "integration" }, enabled = true) public void insertSimplePOJOs() throws Exception { String tableName = "simple_pojo_table"; @@ -76,5 +85,6 @@ public void insertSimplePOJOs() throws Exception { assertTrue(metrics.getMetric(ClientMetrics.OP_SERIALIZATION).getLong() > 0); assertEquals(metrics.getQueryId(), uuid); assertEquals(response.getQueryId(), uuid); + dropTable(tableName); } }