LakshSingla commented on code in PR #12992:
URL: https://github.com/apache/druid/pull/12992#discussion_r973838702
##########
integration-tests/src/main/java/org/apache/druid/testing/utils/AbstractTestQueryHelper.java:
##########
@@ -146,24 +147,29 @@ private void testQueries(String url,
List<QueryResultType> queries) throws Excep
for (QueryResultType queryWithResult : queries) {
LOG.info("Running Query %s", queryWithResult.getQuery());
List<Map<String, Object>> result = queryClient.query(url,
queryWithResult.getQuery());
- if (!QueryResultVerifier.compareResults(result,
queryWithResult.getExpectedResults(),
- queryWithResult.getFieldsToTest()
- )) {
+ Optional<String> resultsComparison =
QueryResultVerifier.compareResults(result, queryWithResult.getExpectedResults(),
+
queryWithResult.getFieldsToTest());
+ if (resultsComparison.isPresent()) {
LOG.error(
"Failed while executing query %s \n expectedResults: %s \n
actualResults : %s",
queryWithResult.getQuery(),
jsonMapper.writeValueAsString(queryWithResult.getExpectedResults()),
jsonMapper.writeValueAsString(result)
);
- failed = true;
+ Assert.fail(StringUtils.format(
+ "Results mismatch while executing the query %s.\n"
+ + "Expected results: %s\n"
+ + "Actual results: %s\n"
+ + "Mismatch error: %s\n",
+ queryWithResult.getQuery(),
+
jsonMapper.writeValueAsString(queryWithResult.getExpectedResults()),
+ jsonMapper.writeValueAsString(result),
+ resultsComparison.get()
+ ));
Review Comment:
Removed the expected and actual results part because that would be the two
large JSON blobs that you mentioned here. The row number should be informed to
the user in the test case. As far as the formatting of the results is
concerned, I think it might be difficult to do so once the file has been
deserialized into an object. One way would be to serialize the expected result
the opposite way the deserialization has happened.
--
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]