|
@@ -146,6 +146,17 @@ public class TestDFSHAAdmin {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testNameserviceOption() throws Exception {
|
|
|
+ assertEquals(-1, runTool("-ns"));
|
|
|
+ assertOutputContains("Missing nameservice ID");
|
|
|
+ assertEquals(-1, runTool("-ns", "ns1"));
|
|
|
+ assertOutputContains("Missing command");
|
|
|
+ // "ns1" isn't defined but we check this lazily and help doesn't use the ns
|
|
|
+ assertEquals(0, runTool("-ns", "ns1", "-help", "transitionToActive"));
|
|
|
+ assertOutputContains("Transitions the service into Active");
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testNamenodeResolution() throws Exception {
|
|
|
Mockito.doReturn(STANDBY_READY_RESULT).when(mockProtocol).getServiceStatus();
|
|
@@ -267,6 +278,15 @@ public class TestDFSHAAdmin {
|
|
|
assertEquals(0, runTool("-failover", "nn1", "nn2"));
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testFailoverWithFencerAndNameservice() throws Exception {
|
|
|
+ Mockito.doReturn(STANDBY_READY_RESULT).when(mockProtocol).getServiceStatus();
|
|
|
+ HdfsConfiguration conf = getHAConf();
|
|
|
+ conf.set(DFSConfigKeys.DFS_HA_FENCE_METHODS_KEY, getFencerTrueCommand());
|
|
|
+ tool.setConf(conf);
|
|
|
+ assertEquals(0, runTool("-ns", "ns1", "-failover", "nn1", "nn2"));
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testFailoverWithFencerConfiguredAndForce() throws Exception {
|
|
|
Mockito.doReturn(STANDBY_READY_RESULT).when(mockProtocol).getServiceStatus();
|