HoustonPutman commented on code in PR #1863: URL: https://github.com/apache/solr/pull/1863#discussion_r1303398270
########## solr/core/src/test/org/apache/solr/cli/ApiToolTest.java: ########## @@ -42,4 +58,48 @@ public void testParsingGetUrl() throws URISyntaxException { assertEquals("select id from COLL_NAME limit 10", params.get("stmt")); } } + + @Test + public void testQueryResponse() throws Exception { + int docCount = 1000; + CollectionAdminRequest.createCollection(COLLECTION_NAME, "config", 2, 1) + .process(cluster.getSolrClient()); + cluster.waitForActiveCollection(COLLECTION_NAME, 2, 2); + + String tmpFileLoc = + new File(cluster.getBaseDir().toFile().getAbsolutePath() + File.separator).getPath(); + + UpdateRequest ur = new UpdateRequest(); + ur.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); + + for (int i = 0; i < docCount; i++) { + ur.add( + "id", + String.valueOf(i), + "desc_s", + TestUtil.randomSimpleString(random(), 10, 50), + "a_dt", + "2019-09-30T05:58:03Z"); + } + cluster.getSolrClient().request(ur, COLLECTION_NAME); + + ApiTool tool = new ApiTool(); + + String response = + tool.callGet( + cluster.getJettySolrRunner(0).getBaseUrl() + + "/" + + COLLECTION_NAME + + "/select?q=*:*&rows=1&fl=id&sort=id+asc"); + // Fields that could be missed because of serialization + assertFindInJson(response, "\"numFound\":1000,"); + // Correct formatting + assertFindInJson(response, "\"docs\":[{"); + } + + private void assertFindInJson(String json, String find) { Review Comment: It's basically an assertStringContains, which I can't find elsewhere... -- 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: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org