Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
b1678ee6
Commit
b1678ee6
authored
Nov 25, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x'
Closes gh-24251
parents
8bcc3d1b
9b992af3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
RedisHealthIndicator.java
...ingframework/boot/actuate/redis/RedisHealthIndicator.java
+1
-1
RedisReactiveHealthIndicator.java
...work/boot/actuate/redis/RedisReactiveHealthIndicator.java
+1
-1
RedisHealthIndicatorTests.java
...amework/boot/actuate/redis/RedisHealthIndicatorTests.java
+3
-3
RedisReactiveHealthIndicatorTests.java
...boot/actuate/redis/RedisReactiveHealthIndicatorTests.java
+2
-2
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/redis/RedisHealthIndicator.java
View file @
b1678ee6
...
@@ -60,7 +60,7 @@ public class RedisHealthIndicator extends AbstractHealthIndicator {
...
@@ -60,7 +60,7 @@ public class RedisHealthIndicator extends AbstractHealthIndicator {
RedisHealth
.
up
(
builder
,
((
RedisClusterConnection
)
connection
).
clusterGetClusterInfo
());
RedisHealth
.
up
(
builder
,
((
RedisClusterConnection
)
connection
).
clusterGetClusterInfo
());
}
}
else
{
else
{
RedisHealth
.
up
(
builder
,
connection
.
info
());
RedisHealth
.
up
(
builder
,
connection
.
info
(
"server"
));
}
}
}
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicator.java
View file @
b1678ee6
...
@@ -67,7 +67,7 @@ public class RedisReactiveHealthIndicator extends AbstractReactiveHealthIndicato
...
@@ -67,7 +67,7 @@ public class RedisReactiveHealthIndicator extends AbstractReactiveHealthIndicato
return
((
ReactiveRedisClusterConnection
)
connection
).
clusterGetClusterInfo
()
return
((
ReactiveRedisClusterConnection
)
connection
).
clusterGetClusterInfo
()
.
map
((
info
)
->
up
(
builder
,
info
));
.
map
((
info
)
->
up
(
builder
,
info
));
}
}
return
connection
.
serverCommands
().
info
().
map
((
info
)
->
up
(
builder
,
info
));
return
connection
.
serverCommands
().
info
(
"server"
).
map
((
info
)
->
up
(
builder
,
info
));
}
}
private
Health
up
(
Health
.
Builder
builder
,
Properties
info
)
{
private
Health
up
(
Health
.
Builder
builder
,
Properties
info
)
{
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisHealthIndicatorTests.java
View file @
b1678ee6
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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
);
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/redis/RedisReactiveHealthIndicatorTests.java
View file @
b1678ee6
...
@@ -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
)
->
{
...
@@ -91,7 +91,7 @@ class RedisReactiveHealthIndicatorTests {
...
@@ -91,7 +91,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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment