SOLR-12388: Add an expected exception message to SearchHandlerTest.testRequireZkConnectedDistrib()

This commit is contained in:
Steve Rowe 2018-05-31 16:09:11 -04:00
parent ce8735556d
commit 252a8145d9
1 changed files with 6 additions and 1 deletions

View File

@ -241,16 +241,21 @@ public class SearchHandlerTest extends SolrTestCaseJ4
Replica connectedReplica = connectedSlice.getReplicas().iterator().next(); Replica connectedReplica = connectedSlice.getReplicas().iterator().next();
try (HttpSolrClient httpSolrClient = new HttpSolrClient.Builder(connectedReplica.getCoreUrl()).build()) { try (HttpSolrClient httpSolrClient = new HttpSolrClient.Builder(connectedReplica.getCoreUrl()).build()) {
ignoreException("ZooKeeper is not connected"); ignoreException("ZooKeeper is not connected");
ignoreException("no servers hosting shard:");
JettySolrRunner disconnectedJetty = miniCluster.getReplicaJetty(disconnectedReplica); JettySolrRunner disconnectedJetty = miniCluster.getReplicaJetty(disconnectedReplica);
disconnectedJetty.getCoreContainer().getZkController().getZkClient().close(); disconnectedJetty.getCoreContainer().getZkController().getZkClient().close();
req.process(httpSolrClient); req.process(httpSolrClient);
fail("An exception should be thrown when ZooKeeper is not connected and shards.tolerant=requireZkConnected"); fail("An exception should be thrown when ZooKeeper is not connected and shards.tolerant=requireZkConnected");
} catch (Exception e) { } catch (Exception e) {
assertTrue("Exception message is missing 'no servers hosting shard:': " + e, e.getMessage().contains("no servers hosting shard:")); assertTrue("Unrecognized exception message: " + e,
e.getMessage().contains("no servers hosting shard:")
|| e.getMessage().contains("ZooKeeper is not connected"));
} }
} }
finally { finally {
miniCluster.shutdown(); miniCluster.shutdown();
unIgnoreException("no servers hosting shard:");
unIgnoreException("ZooKeeper is not connected");
} }
} }