|
@@ -33,6 +33,7 @@ import org.junit.After;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
+import static org.junit.Assert.assertNotEquals;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.Assert.fail;
|
|
import static org.junit.Assert.fail;
|
|
|
|
|
|
@@ -50,7 +51,7 @@ public class TestDFSAdminWithHA {
|
|
private static String newLine = System.getProperty("line.separator");
|
|
private static String newLine = System.getProperty("line.separator");
|
|
|
|
|
|
private void assertOutputMatches(String string) {
|
|
private void assertOutputMatches(String string) {
|
|
- String errOutput = new String(out.toByteArray(), Charsets.UTF_8);
|
|
|
|
|
|
+ String errOutput = new String(err.toByteArray(), Charsets.UTF_8);
|
|
String output = new String(out.toByteArray(), Charsets.UTF_8);
|
|
String output = new String(out.toByteArray(), Charsets.UTF_8);
|
|
|
|
|
|
if (!errOutput.matches(string) && !output.matches(string)) {
|
|
if (!errOutput.matches(string) && !output.matches(string)) {
|
|
@@ -155,6 +156,60 @@ public class TestDFSAdminWithHA {
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testSaveNamespaceNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ // Safe mode should be turned ON in order to create namespace image.
|
|
|
|
+ int exitCode = admin.run(new String[] {"-safemode", "enter"});
|
|
|
|
+ assertEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Safe mode is ON in.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+//
|
|
|
|
+ exitCode = admin.run(new String[] {"-saveNamespace"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "Save namespace successful for.*" + newLine
|
|
|
|
+ + "Save namespace failed for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testSaveNamespaceNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ // Safe mode should be turned ON in order to create namespace image.
|
|
|
|
+ int exitCode = admin.run(new String[] {"-safemode", "enter"});
|
|
|
|
+ assertEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Safe mode is ON in.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+
|
|
|
|
+ exitCode = admin.run(new String[] {"-saveNamespace"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "Save namespace failed for.*" + newLine
|
|
|
|
+ + "Save namespace successful for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testSaveNamespaceNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ // Safe mode should be turned ON in order to create namespace image.
|
|
|
|
+ int exitCode = admin.run(new String[] {"-safemode", "enter"});
|
|
|
|
+ assertEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Safe mode is ON in.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+
|
|
|
|
+ exitCode = admin.run(new String[] {"-saveNamespace"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "Save namespace failed for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test (timeout = 30000)
|
|
@Test (timeout = 30000)
|
|
public void testRestoreFailedStorage() throws Exception {
|
|
public void testRestoreFailedStorage() throws Exception {
|
|
setUpHaCluster(false);
|
|
setUpHaCluster(false);
|
|
@@ -175,6 +230,76 @@ public class TestDFSAdminWithHA {
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRestoreFailedStorageNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-restoreFailedStorage", "check"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "restoreFailedStorage is set to false for.*" + newLine
|
|
|
|
+ + "restoreFailedStorage failed for.*" + newLine;
|
|
|
|
+ // Default is false
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+
|
|
|
|
+ exitCode = admin.run(new String[] {"-restoreFailedStorage", "true"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "restoreFailedStorage is set to true for.*" + newLine
|
|
|
|
+ + "restoreFailedStorage failed for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+
|
|
|
|
+ exitCode = admin.run(new String[] {"-restoreFailedStorage", "false"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "restoreFailedStorage is set to false for.*" + newLine
|
|
|
|
+ + "restoreFailedStorage failed for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRestoreFailedStorageNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-restoreFailedStorage", "check"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "restoreFailedStorage failed for.*" + newLine
|
|
|
|
+ + "restoreFailedStorage is set to false for.*" + newLine;
|
|
|
|
+ // Default is false
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+
|
|
|
|
+ exitCode = admin.run(new String[] {"-restoreFailedStorage", "true"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "restoreFailedStorage failed for.*" + newLine
|
|
|
|
+ + "restoreFailedStorage is set to true for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+
|
|
|
|
+ exitCode = admin.run(new String[] {"-restoreFailedStorage", "false"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "restoreFailedStorage failed for.*" + newLine
|
|
|
|
+ + "restoreFailedStorage is set to false for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRestoreFailedStorageNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-restoreFailedStorage", "check"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "restoreFailedStorage failed for.*";
|
|
|
|
+ // Default is false
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+
|
|
|
|
+ exitCode = admin.run(new String[] {"-restoreFailedStorage", "true"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "restoreFailedStorage failed for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+
|
|
|
|
+ exitCode = admin.run(new String[] {"-restoreFailedStorage", "false"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "restoreFailedStorage failed for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test (timeout = 30000)
|
|
@Test (timeout = 30000)
|
|
public void testRefreshNodes() throws Exception {
|
|
public void testRefreshNodes() throws Exception {
|
|
setUpHaCluster(false);
|
|
setUpHaCluster(false);
|
|
@@ -184,13 +309,82 @@ public class TestDFSAdminWithHA {
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshNodesNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshNodes"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh nodes successful for.*" + newLine
|
|
|
|
+ + "Refresh nodes failed for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshNodesNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshNodes"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh nodes failed for.*" + newLine
|
|
|
|
+ + "Refresh nodes successful for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshNodesNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshNodes"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh nodes failed for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test (timeout = 30000)
|
|
@Test (timeout = 30000)
|
|
public void testSetBalancerBandwidth() throws Exception {
|
|
public void testSetBalancerBandwidth() throws Exception {
|
|
setUpHaCluster(false);
|
|
setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().transitionToActive(0);
|
|
|
|
+
|
|
int exitCode = admin.run(new String[] {"-setBalancerBandwidth", "10"});
|
|
int exitCode = admin.run(new String[] {"-setBalancerBandwidth", "10"});
|
|
assertEquals(err.toString().trim(), 0, exitCode);
|
|
assertEquals(err.toString().trim(), 0, exitCode);
|
|
- String message = "Balancer bandwidth is set to 10 for.*";
|
|
|
|
- assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
|
|
+ String message = "Balancer bandwidth is set to 10";
|
|
|
|
+ assertOutputMatches(message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testSetBalancerBandwidthNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ cluster.getDfsCluster().transitionToActive(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-setBalancerBandwidth", "10"});
|
|
|
|
+ assertEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Balancer bandwidth is set to 10";
|
|
|
|
+ assertOutputMatches(message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testSetBalancerBandwidthNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().transitionToActive(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-setBalancerBandwidth", "10"});
|
|
|
|
+ assertEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Balancer bandwidth is set to 10";
|
|
|
|
+ assertOutputMatches(message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void testSetBalancerBandwidthNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-setBalancerBandwidth", "10"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Balancer bandwidth is set failed." + newLine
|
|
|
|
+ + ".*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
}
|
|
}
|
|
|
|
|
|
@Test (timeout = 30000)
|
|
@Test (timeout = 30000)
|
|
@@ -210,6 +404,44 @@ public class TestDFSAdminWithHA {
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testMetaSaveNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-metasave", "dfs.meta"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Created metasave file dfs.meta in the log directory"
|
|
|
|
+ + " of namenode.*" + newLine
|
|
|
|
+ + "Created metasave file dfs.meta in the log directory"
|
|
|
|
+ + " of namenode.*failed" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testMetaSaveNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-metasave", "dfs.meta"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Created metasave file dfs.meta in the log directory"
|
|
|
|
+ + " of namenode.*failed" + newLine
|
|
|
|
+ + "Created metasave file dfs.meta in the log directory"
|
|
|
|
+ + " of namenode.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testMetaSaveNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-metasave", "dfs.meta"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Created metasave file dfs.meta in the log directory"
|
|
|
|
+ + " of namenode.*failed";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test (timeout = 30000)
|
|
@Test (timeout = 30000)
|
|
public void testRefreshServiceAcl() throws Exception {
|
|
public void testRefreshServiceAcl() throws Exception {
|
|
setUpHaCluster(true);
|
|
setUpHaCluster(true);
|
|
@@ -219,6 +451,40 @@ public class TestDFSAdminWithHA {
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshServiceAclNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(true);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshServiceAcl"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh service acl successful for.*" + newLine
|
|
|
|
+ + "Refresh service acl failed for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshServiceAclNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(true);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshServiceAcl"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh service acl failed for.*" + newLine
|
|
|
|
+ + "Refresh service acl successful for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshServiceAclNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(true);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshServiceAcl"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh service acl failed for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@Test (timeout = 30000)
|
|
@Test (timeout = 30000)
|
|
public void testRefreshUserToGroupsMappings() throws Exception {
|
|
public void testRefreshUserToGroupsMappings() throws Exception {
|
|
setUpHaCluster(false);
|
|
setUpHaCluster(false);
|
|
@@ -228,6 +494,43 @@ public class TestDFSAdminWithHA {
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshUserToGroupsMappingsNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshUserToGroupsMappings"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh user to groups mapping successful for.*"
|
|
|
|
+ + newLine
|
|
|
|
+ + "Refresh user to groups mapping failed for.*"
|
|
|
|
+ + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshUserToGroupsMappingsNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshUserToGroupsMappings"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh user to groups mapping failed for.*"
|
|
|
|
+ + newLine
|
|
|
|
+ + "Refresh user to groups mapping successful for.*"
|
|
|
|
+ + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshUserToGroupsMappingsNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshUserToGroupsMappings"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh user to groups mapping failed for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test (timeout = 30000)
|
|
@Test (timeout = 30000)
|
|
public void testRefreshSuperUserGroupsConfiguration() throws Exception {
|
|
public void testRefreshSuperUserGroupsConfiguration() throws Exception {
|
|
setUpHaCluster(false);
|
|
setUpHaCluster(false);
|
|
@@ -238,6 +541,49 @@ public class TestDFSAdminWithHA {
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshSuperUserGroupsConfigurationNN1UpNN2Down()
|
|
|
|
+ throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(
|
|
|
|
+ new String[] {"-refreshSuperUserGroupsConfiguration"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh super user groups configuration successful for.*"
|
|
|
|
+ + newLine
|
|
|
|
+ + "Refresh super user groups configuration failed for.*"
|
|
|
|
+ + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshSuperUserGroupsConfigurationNN1DownNN2Up()
|
|
|
|
+ throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ int exitCode = admin.run(
|
|
|
|
+ new String[] {"-refreshSuperUserGroupsConfiguration"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh super user groups configuration failed for.*"
|
|
|
|
+ + newLine
|
|
|
|
+ + "Refresh super user groups configuration successful for.*"
|
|
|
|
+ + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshSuperUserGroupsConfigurationNN1DownNN2Down()
|
|
|
|
+ throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(
|
|
|
|
+ new String[] {"-refreshSuperUserGroupsConfiguration"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh super user groups configuration failed for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test (timeout = 30000)
|
|
@Test (timeout = 30000)
|
|
public void testRefreshCallQueue() throws Exception {
|
|
public void testRefreshCallQueue() throws Exception {
|
|
setUpHaCluster(false);
|
|
setUpHaCluster(false);
|
|
@@ -246,4 +592,116 @@ public class TestDFSAdminWithHA {
|
|
String message = "Refresh call queue successful for.*";
|
|
String message = "Refresh call queue successful for.*";
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
assertOutputMatches(message + newLine + message + newLine);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshCallQueueNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshCallQueue"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh call queue successful for.*" + newLine
|
|
|
|
+ + "Refresh call queue failed for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshCallQueueNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshCallQueue"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh call queue failed for.*" + newLine
|
|
|
|
+ + "Refresh call queue successful for.*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testRefreshCallQueueNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-refreshCallQueue"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Refresh call queue failed for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testFinalizeUpgrade() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-finalizeUpgrade"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = ".*Cannot finalize with no NameNode active";
|
|
|
|
+ assertOutputMatches(message + newLine);
|
|
|
|
+
|
|
|
|
+ cluster.getDfsCluster().transitionToActive(0);
|
|
|
|
+ exitCode = admin.run(new String[] {"-finalizeUpgrade"});
|
|
|
|
+ assertEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ message = "Finalize upgrade successful for.*";
|
|
|
|
+ assertOutputMatches(message + newLine + message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testFinalizeUpgradeNN1UpNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ cluster.getDfsCluster().transitionToActive(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-finalizeUpgrade"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Finalize upgrade successful for .*" + newLine
|
|
|
|
+ + "Finalize upgrade failed for .*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testFinalizeUpgradeNN1DownNN2Up() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().transitionToActive(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-finalizeUpgrade"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = "Finalize upgrade failed for .*" + newLine
|
|
|
|
+ + "Finalize upgrade successful for .*" + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testFinalizeUpgradeNN1DownNN2Down() throws Exception {
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-finalizeUpgrade"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = ".*2 exceptions.*";
|
|
|
|
+ assertOutputMatches(message + newLine);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testListOpenFilesNN1UpNN2Down() throws Exception{
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ cluster.getDfsCluster().transitionToActive(0);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-listOpenFiles"});
|
|
|
|
+ assertEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test (timeout = 30000)
|
|
|
|
+ public void testListOpenFilesNN1DownNN2Up() throws Exception{
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().transitionToActive(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-listOpenFiles"});
|
|
|
|
+ assertEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void testListOpenFilesNN1DownNN2Down() throws Exception{
|
|
|
|
+ setUpHaCluster(false);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(0);
|
|
|
|
+ cluster.getDfsCluster().shutdownNameNode(1);
|
|
|
|
+ int exitCode = admin.run(new String[] {"-listOpenFiles"});
|
|
|
|
+ assertNotEquals(err.toString().trim(), 0, exitCode);
|
|
|
|
+ String message = ".*" + newLine + "List open files failed." + newLine;
|
|
|
|
+ assertOutputMatches(message);
|
|
|
|
+ }
|
|
}
|
|
}
|