Skip to content

Apache Lucene open-source search software

SOLR-4019: Fix tests that are invalid due to logging change

James Dyerf1a67f7cb090
diff --git a/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
index 6ed6577c592..d06783fc5f8 100644
--- a/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
@@ -84,19 +84,16 @@ public class PingRequestHandlerTest extends SolrTestCaseJ4 {
assertEquals("OK", rsp.getValues().get("status"));
}
- @Ignore
public void testEnablingServer() throws Exception {
assertTrue(! healthcheckFile.exists());
// first make sure that ping responds back that the service is disabled
-
- try {
- makeRequest(handler, req());
- fail("Should have thrown a SolrException because not enabled yet");
- } catch (SolrException se){
- assertEquals(SolrException.ErrorCode.SERVICE_UNAVAILABLE.code,se.code());
- }
+ SolrQueryResponse sqr = makeRequest(handler, req());
+ SolrException se = (SolrException) sqr.getException();
+ assertEquals(
+ "Response should have been replaced with a 503 SolrException.",
+ se.code(), SolrException.ErrorCode.SERVICE_UNAVAILABLE.code);
// now enable
@@ -115,7 +112,6 @@ public class PingRequestHandlerTest extends SolrTestCaseJ4 {
assertTrue(healthcheckFile.exists());
}
- @Ignore
public void testDisablingServer() throws Exception {
assertTrue(! healthcheckFile.exists());
@@ -133,14 +129,12 @@ public class PingRequestHandlerTest extends SolrTestCaseJ4 {
assertFalse(healthcheckFile.exists());
- // now make sure that ping responds back that the service is disabled
-
- try {
- makeRequest(handler, req());
- fail("Should have thrown a SolrException because not enabled yet");
- } catch (SolrException se){
- assertEquals(SolrException.ErrorCode.SERVICE_UNAVAILABLE.code,se.code());
- }
+ // now make sure that ping responds back that the service is disabled
+ SolrQueryResponse sqr = makeRequest(handler, req());
+ SolrException se = (SolrException) sqr.getException();
+ assertEquals(
+ "Response should have been replaced with a 503 SolrException.",
+ se.code(), SolrException.ErrorCode.SERVICE_UNAVAILABLE.code);
// disable when already disabled shouldn't cause any problems
makeRequest(handler, req("action", "disable"));