mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Merge pull request #1586 from qixiaobo/patch-2
to avoid k8s readinessProbe remove the pod
This commit is contained in:
commit
347e1454b7
@ -105,7 +105,7 @@ public class SentinelHealthIndicator extends AbstractHealthIndicator {
|
|||||||
// If failed to send heartbeat message, means that the Dashboard is DOWN
|
// If failed to send heartbeat message, means that the Dashboard is DOWN
|
||||||
dashboardUp = false;
|
dashboardUp = false;
|
||||||
detailMap.put("dashboard",
|
detailMap.put("dashboard",
|
||||||
new Status(Status.DOWN.getCode(), String.format(
|
new Status(Status.UNKNOWN.getCode(), String.format(
|
||||||
"the dashboard servers [%s] one of them can't be connected",
|
"the dashboard servers [%s] one of them can't be connected",
|
||||||
consoleServerList)));
|
consoleServerList)));
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ public class SentinelHealthIndicator extends AbstractHealthIndicator {
|
|||||||
// DOWN
|
// DOWN
|
||||||
dataSourceUp = false;
|
dataSourceUp = false;
|
||||||
dataSourceDetailMap.put(dataSourceBeanName,
|
dataSourceDetailMap.put(dataSourceBeanName,
|
||||||
new Status(Status.DOWN.getCode(), e.getMessage()));
|
new Status(Status.UNKNOWN.getCode(), e.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ public class SentinelHealthIndicator extends AbstractHealthIndicator {
|
|||||||
builder.up().withDetails(detailMap);
|
builder.up().withDetails(detailMap);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
builder.down().withDetails(detailMap);
|
builder.unknown().withDetails(detailMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,9 +109,9 @@ public class SentinelHealthIndicatorTests {
|
|||||||
|
|
||||||
Health health = sentinelHealthIndicator.health();
|
Health health = sentinelHealthIndicator.health();
|
||||||
|
|
||||||
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
|
assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN);
|
||||||
assertThat(health.getDetails().get("dashboard")).isEqualTo(
|
assertThat(health.getDetails().get("dashboard")).isEqualTo(
|
||||||
new Status(Status.DOWN.getCode(), "localhost:8080 can't be connected"));
|
new Status(Status.UNKNOWN.getCode(), "localhost:8080 can't be connected"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -163,13 +163,13 @@ public class SentinelHealthIndicatorTests {
|
|||||||
|
|
||||||
Health health = sentinelHealthIndicator.health();
|
Health health = sentinelHealthIndicator.health();
|
||||||
|
|
||||||
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
|
assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN);
|
||||||
Map<String, Status> dataSourceDetailMap = (Map<String, Status>) health
|
Map<String, Status> dataSourceDetailMap = (Map<String, Status>) health
|
||||||
.getDetails().get("dataSource");
|
.getDetails().get("dataSource");
|
||||||
assertThat(dataSourceDetailMap.get("ds1-sentinel-file-datasource"))
|
assertThat(dataSourceDetailMap.get("ds1-sentinel-file-datasource"))
|
||||||
.isEqualTo(Status.UP);
|
.isEqualTo(Status.UP);
|
||||||
assertThat(dataSourceDetailMap.get("ds2-sentinel-file-datasource"))
|
assertThat(dataSourceDetailMap.get("ds2-sentinel-file-datasource"))
|
||||||
.isEqualTo(new Status(Status.DOWN.getCode(), "fileDataSource2 error"));
|
.isEqualTo(new Status(Status.UNKNOWN.getCode(), "fileDataSource2 error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user