HDFS-14259. RBF: Fix safemode message for Router. Contributed by Ranith Sadar.
This commit is contained in:
parent
1c7ab59be3
commit
7bbe01a196
@ -234,7 +234,7 @@ public long getProvidedCapacity() {
|
||||
@Override
|
||||
public String getSafemode() {
|
||||
try {
|
||||
if (!getRouter().isRouterState(RouterServiceState.SAFEMODE)) {
|
||||
if (getRouter().isRouterState(RouterServiceState.SAFEMODE)) {
|
||||
return "Safe mode is ON. " + this.getSafeModeTip();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -747,6 +747,9 @@ public void testSafeModeStatus() throws Exception {
|
||||
|
||||
FederationMetrics metrics = router.getMetrics();
|
||||
String jsonString = metrics.getRouterStatus();
|
||||
String result = router.getNamenodeMetrics().getSafemode();
|
||||
assertTrue("Wrong safe mode message: " + result,
|
||||
result.startsWith("Safe mode is ON."));
|
||||
|
||||
// verify state using FederationMetrics
|
||||
assertEquals(RouterServiceState.SAFEMODE.toString(), jsonString);
|
||||
@ -756,6 +759,9 @@ public void testSafeModeStatus() throws Exception {
|
||||
assertEquals(0,
|
||||
ToolRunner.run(admin, new String[] {"-safemode", "leave" }));
|
||||
jsonString = metrics.getRouterStatus();
|
||||
result = router.getNamenodeMetrics().getSafemode();
|
||||
assertEquals("Wrong safe mode message: " + result, "", result);
|
||||
|
||||
// verify state
|
||||
assertEquals(RouterServiceState.RUNNING.toString(), jsonString);
|
||||
assertFalse(routerContext.getRouter().getSafemodeService().isInSafeMode());
|
||||
|
Loading…
Reference in New Issue
Block a user