epugh commented on code in PR #4183:
URL: https://github.com/apache/solr/pull/4183#discussion_r2886330574


##########
solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.java:
##########
@@ -257,6 +261,35 @@ public void testSelect() throws Exception {
     assertEquals(0, ((SolrDocumentList) 
v2Response.getResponse().get("response")).getNumFound());
   }
 
+  @Test
+  public void testV2ApiErrorHandling() throws Exception {
+    final var deleteRequest = new 
CollectionsApi.DeleteCollection("collection-does-not-exist");
+
+    // Test with "Http" client
+    final String baseUrl = 
cluster.getJettySolrRunner(0).getBaseUrl().toString();
+    try (var httpClient = new HttpJettySolrClient.Builder(baseUrl).build()) {
+      final var ex =
+          expectThrows(RemoteSolrException.class, () -> 
deleteRequest.process(httpClient));
+      assertRSECodeAndMessage(ex, 400, "Could not find collection", 
"collection-does-not-exist");
+    }
+
+    // Test with "Cloud" client
+    final var ex =
+        expectThrows(
+            RemoteSolrException.class, () -> 
deleteRequest.process(cluster.getSolrClient()));
+    assertRSECodeAndMessage(ex, 400, "Could not find collection", 
"collection-does-not-exist");
+  }
+
+  private void assertRSECodeAndMessage(

Review Comment:
   THanks..



-- 
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]

Reply via email to