janhoy commented on a change in pull request #648: URL: https://github.com/apache/solr/pull/648#discussion_r810506121
########## File path: solr/core/src/test/org/apache/solr/servlet/HttpSolrCallCloudTest.java ########## @@ -54,19 +54,28 @@ public static void setupCluster() throws Exception { } @Test - public void test() throws Exception { + public void testCoreChosen() throws Exception { assertCoreChosen(NUM_SHARD, new TestRequest("/collection1/update")); assertCoreChosen(NUM_SHARD, new TestRequest("/collection1/update/json")); assertCoreChosen(NUM_SHARD * REPLICA_FACTOR, new TestRequest("/collection1/select")); } + // https://issues.apache.org/jira/browse/SOLR-16019 + @Test + public void testRequestParsingFails() throws Exception { + var baseUrl = cluster.getJettySolrRunner(0).getBaseUrl(); + var request = new URL(baseUrl.toString() + "/" + COLLECTION + "/select?q=%C0"); // Illegal UTF-8 string + var connection = (HttpURLConnection) request.openConnection(); + assertEquals(400, connection.getResponseCode()); + } + private void assertCoreChosen(int numCores, TestRequest testRequest) throws UnavailableException { - JettySolrRunner jettySolrRunner = cluster.getJettySolrRunner(0); - Set<String> coreNames = new HashSet<>(); - SolrDispatchFilter dispatchFilter = jettySolrRunner.getSolrDispatchFilter(); + var jettySolrRunner = cluster.getJettySolrRunner(0); + var coreNames = new HashSet<String>(); + var dispatchFilter = jettySolrRunner.getSolrDispatchFilter(); for (int i = 0; i < NUM_SHARD * REPLICA_FACTOR * 20; i++) { if (coreNames.size() == numCores) return; - HttpSolrCall httpSolrCall = new HttpSolrCall(dispatchFilter, dispatchFilter.getCores(), testRequest, new TestResponse(), false); Review comment: Not neecssary, just updating the when visiting this class. But I can move them to a separate PR, in case someone wants to cherry-pick this bugfix to 8.x which does not handle var well. -- 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