|
|
|
@ -70,6 +70,17 @@ class RabbitHealthIndicatorTests { |
|
|
|
assertThat(health.getDetails()).containsEntry("version", "123"); |
|
|
|
assertThat(health.getDetails()).containsEntry("version", "123"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
void healthWhenVersionIsMissingShouldReturnUpWithUnknownVersion() { |
|
|
|
|
|
|
|
givenTemplateExecutionWillInvokeCallback(); |
|
|
|
|
|
|
|
Connection connection = mock(Connection.class); |
|
|
|
|
|
|
|
given(this.channel.getConnection()).willReturn(connection); |
|
|
|
|
|
|
|
given(connection.getServerProperties()).willReturn(Collections.emptyMap()); |
|
|
|
|
|
|
|
Health health = new RabbitHealthIndicator(this.rabbitTemplate).health(); |
|
|
|
|
|
|
|
assertThat(health.getStatus()).isEqualTo(Status.UP); |
|
|
|
|
|
|
|
assertThat(health.getDetails()).containsEntry("version", "unknown"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void healthWhenConnectionFailsShouldReturnDown() { |
|
|
|
void healthWhenConnectionFailsShouldReturnDown() { |
|
|
|
givenTemplateExecutionWillInvokeCallback(); |
|
|
|
givenTemplateExecutionWillInvokeCallback(); |
|
|
|
|