Hoss Man created SOLR-11456:
-------------------------------

             Summary: HealthCheckHandlerTest.testHealthCheckHandler() asserts 
nothing useful
                 Key: SOLR-11456
                 URL: https://issues.apache.org/jira/browse/SOLR-11456
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Hoss Man


The meat of {{HealthCheckHandlerTest.testHealthCheckHandler()}} currently looks 
like this...

{code}
      while (live_nodes.size() == 1 && counter++ < 100) {
        Thread.sleep(100);
        live_nodes = 
cluster.getSolrClient().getZkStateReader().getClusterState().getLiveNodes();
      }

      try {
        req.process(httpSolrClient);
      } catch (HttpSolrClient.RemoteSolrException e) {
        assertTrue(e.getMessage(), e.getMessage().contains("Host Unavailable"));
        assertEquals(SolrException.ErrorCode.SERVICE_UNAVAILABLE.code, 
e.code());
      }
{code}

* nothing actually asserts that {{live_nodes.size() != 1}} -- so the loop could 
just exit after 100 iterations w/o any changes to hte system happening.
* instead of using expectThrows, the only assertions are inside the catch block 
-- if the code (unexpectedly) succeeds the test will not fail (false positive)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to