Skip to content

Commit

Permalink
Adding tests and a helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
Paultagoras committed Jun 20, 2024
1 parent d0853b4 commit b061b48
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ public long getResultRows() {
return progress.get().getResultRows();
}

public String getQueryId() {
return progress.get().getQueryId();
}

public boolean isEmpty() {
return progress.get().isEmpty() && stats.get().isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,21 @@ public void testPost() throws ClickHouseException {
}
}

@Test(groups = {"integration"})
public void testQueryId() throws ClickHouseException {
ClickHouseNode server = getServer(ClickHouseProtocol.HTTP);
String uuid = UUID.randomUUID().toString();

try (ClickHouseClient client = ClickHouseClient.builder().options(getClientOptions())
.defaultCredentials(ClickHouseCredentials.fromUserAndPassword("foo", "bar")).build()) {
try (ClickHouseResponse resp = newRequest(client, server).compressServerResponse(false)
.format(ClickHouseFormat.RowBinaryWithNamesAndTypes)
.query("select 1,2", uuid).executeAndWait()) {
Assert.assertEquals(resp.getSummary().getQueryId(), uuid);
}
}
}

@Test(groups = {"integration"})
public void testProxyConnection() throws ClickHouseException, IOException {
ToxiproxyContainer toxiproxy = null;
Expand Down

0 comments on commit b061b48

Please sign in to comment.