Skip to content

Commit 780030a

Browse files
committed
Test also for an unhealthy state.
1 parent 853ef8f commit 780030a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

solr/cross-dc-manager/src/test/org/apache/solr/crossdc/manager/SolrAndKafkaIntegrationTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,21 @@ public void testMetricsAndHealthcheck() throws Exception {
381381
assertEquals(Boolean.TRUE, map.get("kafka"));
382382
assertEquals(Boolean.TRUE, map.get("solr"));
383383
assertEquals(Boolean.TRUE, map.get("running"));
384+
385+
// kill Solr to trigger unhealthy state
386+
solrCluster2.shutdown();
387+
solrCluster2 = null;
388+
Thread.sleep(5000);
389+
rsp = httpJettySolrClient.request(req);
390+
content =
391+
IOUtils.toString(
392+
(InputStream) rsp.get(InputStreamResponseParser.STREAM_KEY), StandardCharsets.UTF_8);
393+
assertEquals(Integer.valueOf(503), rsp.get("responseStatus"));
394+
map = (Map<String, Object>) ObjectBuilder.fromJSON(content);
395+
assertEquals(Boolean.TRUE, map.get("kafka"));
396+
assertEquals(Boolean.FALSE, map.get("solr"));
397+
assertEquals(Boolean.TRUE, map.get("running"));
398+
384399
} finally {
385400
httpJettySolrClient.close();
386401
client.close();

0 commit comments

Comments
 (0)