|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.actuate.cassandra;
|
|
|
|
|
|
|
|
|
|
import java.time.Duration;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
@ -61,7 +62,8 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
Mono<Health> health = healthIndicator.health();
|
|
|
|
|
StepVerifier.create(health)
|
|
|
|
|
.consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP))
|
|
|
|
|
.verifyComplete();
|
|
|
|
|
.expectComplete()
|
|
|
|
|
.verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -71,7 +73,8 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
Mono<Health> health = healthIndicator.health();
|
|
|
|
|
StepVerifier.create(health)
|
|
|
|
|
.consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN))
|
|
|
|
|
.verifyComplete();
|
|
|
|
|
.expectComplete()
|
|
|
|
|
.verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -81,7 +84,8 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
Mono<Health> health = healthIndicator.health();
|
|
|
|
|
StepVerifier.create(health)
|
|
|
|
|
.consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN))
|
|
|
|
|
.verifyComplete();
|
|
|
|
|
.expectComplete()
|
|
|
|
|
.verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -91,7 +95,8 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
Mono<Health> health = healthIndicator.health();
|
|
|
|
|
StepVerifier.create(health)
|
|
|
|
|
.consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN))
|
|
|
|
|
.verifyComplete();
|
|
|
|
|
.expectComplete()
|
|
|
|
|
.verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -101,7 +106,8 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
Mono<Health> health = healthIndicator.health();
|
|
|
|
|
StepVerifier.create(health)
|
|
|
|
|
.consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP))
|
|
|
|
|
.verifyComplete();
|
|
|
|
|
.expectComplete()
|
|
|
|
|
.verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -111,7 +117,8 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
Mono<Health> health = healthIndicator.health();
|
|
|
|
|
StepVerifier.create(health)
|
|
|
|
|
.consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP))
|
|
|
|
|
.verifyComplete();
|
|
|
|
|
.expectComplete()
|
|
|
|
|
.verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -121,7 +128,8 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
Mono<Health> health = healthIndicator.health();
|
|
|
|
|
StepVerifier.create(health)
|
|
|
|
|
.consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP))
|
|
|
|
|
.verifyComplete();
|
|
|
|
|
.expectComplete()
|
|
|
|
|
.verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -139,7 +147,7 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
assertThat(h.getStatus()).isEqualTo(Status.UP);
|
|
|
|
|
assertThat(h.getDetails()).containsOnlyKeys("version");
|
|
|
|
|
assertThat(h.getDetails()).containsEntry("version", Version.V4_0_0);
|
|
|
|
|
}).verifyComplete();
|
|
|
|
|
}).expectComplete().verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -150,7 +158,7 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
StepVerifier.create(health).consumeNextWith((h) -> {
|
|
|
|
|
assertThat(h.getStatus()).isEqualTo(Status.UP);
|
|
|
|
|
assertThat(h.getDetails()).doesNotContainKey("version");
|
|
|
|
|
}).verifyComplete();
|
|
|
|
|
}).expectComplete().verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -165,7 +173,7 @@ class CassandraDriverReactiveHealthIndicatorTests {
|
|
|
|
|
assertThat(h.getDetails()).containsOnlyKeys("error");
|
|
|
|
|
assertThat(h.getDetails()).containsEntry("error",
|
|
|
|
|
DriverTimeoutException.class.getName() + ": Test Exception");
|
|
|
|
|
}).verifyComplete();
|
|
|
|
|
}).expectComplete().verify(Duration.ofSeconds(30));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private CqlSession mockCqlSessionWithNodeState(NodeState... nodeStates) {
|
|
|
|
|