Commit 9b992af3 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '2.2.x' into 2.3.x

Closes gh-24250
parents c383ab78 47efbd90
...@@ -65,7 +65,7 @@ public class RedisHealthIndicator extends AbstractHealthIndicator { ...@@ -65,7 +65,7 @@ public class RedisHealthIndicator extends AbstractHealthIndicator {
.withDetail("slots_fail", clusterInfo.getSlotsFail()); .withDetail("slots_fail", clusterInfo.getSlotsFail());
} }
else { else {
String version = connection.info().getProperty(REDIS_VERSION_PROPERTY); String version = connection.info("server").getProperty(REDIS_VERSION_PROPERTY);
builder.up().withDetail("version", version); builder.up().withDetail("version", version);
} }
} }
......
...@@ -55,7 +55,7 @@ public class RedisReactiveHealthIndicator extends AbstractReactiveHealthIndicato ...@@ -55,7 +55,7 @@ public class RedisReactiveHealthIndicator extends AbstractReactiveHealthIndicato
private Mono<Health> doHealthCheck(Health.Builder builder, ReactiveRedisConnection connection) { private Mono<Health> doHealthCheck(Health.Builder builder, ReactiveRedisConnection connection) {
boolean isClusterConnection = connection instanceof ReactiveRedisClusterConnection; boolean isClusterConnection = connection instanceof ReactiveRedisClusterConnection;
return connection.serverCommands().info().map((info) -> up(builder, info, isClusterConnection)) return connection.serverCommands().info("server").map((info) -> up(builder, info, isClusterConnection))
.onErrorResume((ex) -> Mono.just(down(builder, ex))) .onErrorResume((ex) -> Mono.just(down(builder, ex)))
.flatMap((health) -> connection.closeLater().thenReturn(health)); .flatMap((health) -> connection.closeLater().thenReturn(health));
} }
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -51,7 +51,7 @@ class RedisHealthIndicatorTests { ...@@ -51,7 +51,7 @@ class RedisHealthIndicatorTests {
Properties info = new Properties(); Properties info = new Properties();
info.put("redis_version", "2.8.9"); info.put("redis_version", "2.8.9");
RedisConnection redisConnection = mock(RedisConnection.class); RedisConnection redisConnection = mock(RedisConnection.class);
given(redisConnection.info()).willReturn(info); given(redisConnection.info("server")).willReturn(info);
RedisHealthIndicator healthIndicator = createHealthIndicator(redisConnection); RedisHealthIndicator healthIndicator = createHealthIndicator(redisConnection);
Health health = healthIndicator.health(); Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getStatus()).isEqualTo(Status.UP);
...@@ -61,7 +61,7 @@ class RedisHealthIndicatorTests { ...@@ -61,7 +61,7 @@ class RedisHealthIndicatorTests {
@Test @Test
void redisIsDown() { void redisIsDown() {
RedisConnection redisConnection = mock(RedisConnection.class); RedisConnection redisConnection = mock(RedisConnection.class);
given(redisConnection.info()).willThrow(new RedisConnectionFailureException("Connection failed")); given(redisConnection.info("server")).willThrow(new RedisConnectionFailureException("Connection failed"));
RedisHealthIndicator healthIndicator = createHealthIndicator(redisConnection); RedisHealthIndicator healthIndicator = createHealthIndicator(redisConnection);
Health health = healthIndicator.health(); Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getStatus()).isEqualTo(Status.DOWN);
......
...@@ -55,7 +55,7 @@ class RedisReactiveHealthIndicatorTests { ...@@ -55,7 +55,7 @@ class RedisReactiveHealthIndicatorTests {
ReactiveRedisConnection redisConnection = mock(ReactiveRedisConnection.class); ReactiveRedisConnection redisConnection = mock(ReactiveRedisConnection.class);
given(redisConnection.closeLater()).willReturn(Mono.empty()); given(redisConnection.closeLater()).willReturn(Mono.empty());
ReactiveServerCommands commands = mock(ReactiveServerCommands.class); ReactiveServerCommands commands = mock(ReactiveServerCommands.class);
given(commands.info()).willReturn(Mono.just(info)); given(commands.info("server")).willReturn(Mono.just(info));
RedisReactiveHealthIndicator healthIndicator = createHealthIndicator(redisConnection, commands); RedisReactiveHealthIndicator healthIndicator = createHealthIndicator(redisConnection, commands);
Mono<Health> health = healthIndicator.health(); Mono<Health> health = healthIndicator.health();
StepVerifier.create(health).consumeNextWith((h) -> { StepVerifier.create(health).consumeNextWith((h) -> {
...@@ -73,7 +73,7 @@ class RedisReactiveHealthIndicatorTests { ...@@ -73,7 +73,7 @@ class RedisReactiveHealthIndicatorTests {
ReactiveRedisConnection redisConnection = mock(ReactiveRedisClusterConnection.class); ReactiveRedisConnection redisConnection = mock(ReactiveRedisClusterConnection.class);
given(redisConnection.closeLater()).willReturn(Mono.empty()); given(redisConnection.closeLater()).willReturn(Mono.empty());
ReactiveClusterServerCommands commands = mock(ReactiveClusterServerCommands.class); ReactiveClusterServerCommands commands = mock(ReactiveClusterServerCommands.class);
given(commands.info()).willReturn(Mono.just(info)); given(commands.info("server")).willReturn(Mono.just(info));
RedisReactiveHealthIndicator healthIndicator = createHealthIndicator(redisConnection, commands); RedisReactiveHealthIndicator healthIndicator = createHealthIndicator(redisConnection, commands);
Mono<Health> health = healthIndicator.health(); Mono<Health> health = healthIndicator.health();
StepVerifier.create(health).consumeNextWith((h) -> { StepVerifier.create(health).consumeNextWith((h) -> {
...@@ -87,7 +87,7 @@ class RedisReactiveHealthIndicatorTests { ...@@ -87,7 +87,7 @@ class RedisReactiveHealthIndicatorTests {
@Test @Test
void redisCommandIsDown() { void redisCommandIsDown() {
ReactiveServerCommands commands = mock(ReactiveServerCommands.class); ReactiveServerCommands commands = mock(ReactiveServerCommands.class);
given(commands.info()).willReturn(Mono.error(new RedisConnectionFailureException("Connection failed"))); given(commands.info("server")).willReturn(Mono.error(new RedisConnectionFailureException("Connection failed")));
ReactiveRedisConnection redisConnection = mock(ReactiveRedisConnection.class); ReactiveRedisConnection redisConnection = mock(ReactiveRedisConnection.class);
given(redisConnection.closeLater()).willReturn(Mono.empty()); given(redisConnection.closeLater()).willReturn(Mono.empty());
RedisReactiveHealthIndicator healthIndicator = createHealthIndicator(redisConnection, commands); RedisReactiveHealthIndicator healthIndicator = createHealthIndicator(redisConnection, commands);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment