Harmonize Solr status health details

This commit renames the `solrStatus` property of the Solr health indicator
to `status` and its type. This is now an integer corresponding to the
status Solr sent rather than a String that can be "OK" when all is well.

Closes gh-8878
This commit is contained in:
Stephane Nicoll
2017-04-13 18:40:47 +02:00
parent 23360d11a2
commit b9d1f5e097
2 changed files with 3 additions and 4 deletions

View File

@@ -43,8 +43,7 @@ public class SolrHealthIndicator extends AbstractHealthIndicator {
CoreAdminResponse response = request.process(this.solrClient);
int statusCode = response.getStatus();
Status status = (statusCode == 0 ? Status.UP : Status.DOWN);
builder.status(status).withDetail("solrStatus",
(statusCode == 0 ? "OK" : statusCode));
builder.status(status).withDetail("status", statusCode);
}
}

View File

@@ -72,7 +72,7 @@ public class SolrHealthIndicatorTests {
SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().get("solrStatus")).isEqualTo("OK");
assertThat(health.getDetails().get("status")).isEqualTo(0);
}
@Test
@@ -83,7 +83,7 @@ public class SolrHealthIndicatorTests {
SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
assertThat(health.getDetails().get("solrStatus")).isEqualTo(400);
assertThat(health.getDetails().get("status")).isEqualTo(400);
}
@Test