Fly-Style commented on code in PR #18805:
URL: https://github.com/apache/druid/pull/18805#discussion_r2586135977
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryTestBase.java:
##########
@@ -102,10 +111,46 @@ void setUp()
}
}
+ /**
+ * Ingests Druid with some the data from {@link
MoreResources.Task#BASIC_INDEX} in a synchronous manner.
+ *
+ * @return ingested datasource name
+ */
+ protected String ingestBasicData()
+ {
+ String datasourceName = EmbeddedClusterApis.createTestDatasourceName();
+
+ final String taskId = IdUtils.getRandomId();
+ final IndexTask task =
MoreResources.Task.BASIC_INDEX.get().dataSource(datasourceName).withId(taskId);
+ cluster.callApi().onLeaderOverlord(o -> o.runTask(taskId, task));
+ cluster.callApi().waitForTaskToSucceed(taskId, overlord);
+ cluster.callApi().waitForAllSegmentsToBeAvailable(datasourceName,
coordinator, broker);
+ return datasourceName;
+ }
+
+ /**
+ * Execute an async SQL query against the given endpoint via the HTTP client.
+ */
+ protected ListenableFuture<StatusResponseHolder> executeQueryAsync(String
endpoint, String query)
+ {
+ URL url;
+ try {
+ url = new URL(endpoint);
+ }
+ catch (MalformedURLException e) {
+ throw new AssertionError("Malformed URL");
+ }
+
+ Request request = new Request(HttpMethod.POST, url);
+ request.addHeader("Content-Type", MediaType.APPLICATION_JSON);
+ request.setContent(query.getBytes(StandardCharsets.UTF_8));
+ return httpClientRef.go(request, StatusResponseHandler.getInstance());
Review Comment:
It was a leftover from the first test I've actually done, so, such
modification makes sense.
UPD: we need specifically a `ListenableFuture<StatusResponseHolder>` to know
the status code in tests. So, no modification. :(
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]