rishisankar commented on a change in pull request #1688: URL: https://github.com/apache/lucene-solr/pull/1688#discussion_r463357149
########## File path: solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java ########## @@ -1074,4 +1077,37 @@ private void queryWithPreferReplicaTypes(CloudHttp2SolrClient cloudClient, } } + /** + * Tests the async request code pathway to ensure that normal requests will trigger the onSuccess callback. + */ + @Test + public void asyncRequestTest() throws Exception { + final String collectionName = "asyncRequestCollection"; + + // Create collection + CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1).process(cluster.getSolrClient()); + cluster.waitForActiveCollection(collectionName, 2, 2); + + AsyncListener<LBHttp2SolrClient.Rsp> callback = new AsyncListener<>() { + @Override + public void onSuccess(LBHttp2SolrClient.Rsp rsp) { asyncCallbackRun = true; } + + @Override + public void onFailure(Throwable throwable) { } + }; + + QueryRequest request = new QueryRequest(); // params of the request aren't important for this test + + // Test success callback runs on a "successful" request + asyncCallbackRun = false; + getRandomClient().asyncRequest(request, collectionName, callback); + + // Wait for up to 500ms timeout success callback to run + int count = 0; + while (!asyncCallbackRun && ++count <= 20) { + Thread.sleep(25); Review comment: Just updated to use a Semaphore instead. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org