You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2017/10/11 22:33:00 UTC

[jira] [Resolved] (SOLR-11456) HealthCheckHandlerTest.testHealthCheckHandler() asserts nothing useful

     [ https://issues.apache.org/jira/browse/SOLR-11456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hoss Man resolved SOLR-11456.
-----------------------------
       Resolution: Fixed
         Assignee: Hoss Man
    Fix Version/s: master (8.0)

> 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
>            Assignee: Hoss Man
>             Fix For: master (8.0)
>
>         Attachments: SOLR-11456.patch, SOLR-11456.patch
>
>
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org