From f1a67f7cb090290b57707b273ef29efc6d660289 Mon Sep 17 00:00:00 2001 From: James Dyer Date: Mon, 5 Nov 2012 18:51:00 +0000 Subject: [PATCH] SOLR-4019: Fix tests that are invalid due to logging change git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1405919 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/handler/PingRequestHandlerTest.java | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) 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"));