HDFS-6693. TestDFSAdminWithHA fails on windows ( Contributed by Vinayakumar B )
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1611441 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
875592220f
commit
ce1659f070
@ -324,6 +324,8 @@ Release 2.6.0 - UNRELEASED
|
|||||||
HDFS-6478. RemoteException can't be retried properly for non-HA scenario.
|
HDFS-6478. RemoteException can't be retried properly for non-HA scenario.
|
||||||
(Ming Ma via jing9)
|
(Ming Ma via jing9)
|
||||||
|
|
||||||
|
HDFS-6693. TestDFSAdminWithHA fails on windows ( vinayakumarb )
|
||||||
|
|
||||||
Release 2.5.0 - UNRELEASED
|
Release 2.5.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||||
@ -46,6 +47,7 @@ public class TestDFSAdminWithHA {
|
|||||||
private PrintStream originErr;
|
private PrintStream originErr;
|
||||||
|
|
||||||
private static final String NSID = "ns1";
|
private static final String NSID = "ns1";
|
||||||
|
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(out.toByteArray(), Charsets.UTF_8);
|
||||||
@ -99,6 +101,14 @@ public void tearDown() throws Exception {
|
|||||||
System.err.flush();
|
System.err.flush();
|
||||||
System.setOut(originOut);
|
System.setOut(originOut);
|
||||||
System.setErr(originErr);
|
System.setErr(originErr);
|
||||||
|
if (admin != null) {
|
||||||
|
admin.close();
|
||||||
|
}
|
||||||
|
if (cluster != null) {
|
||||||
|
cluster.shutdown();
|
||||||
|
}
|
||||||
|
out.reset();
|
||||||
|
err.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 30000)
|
@Test(timeout = 30000)
|
||||||
@ -108,25 +118,25 @@ public void testSetSafeMode() throws Exception {
|
|||||||
int exitCode = admin.run(new String[] {"-safemode", "enter"});
|
int exitCode = admin.run(new String[] {"-safemode", "enter"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "Safe mode is ON in.*";
|
String message = "Safe mode is ON in.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
|
|
||||||
// Get safemode
|
// Get safemode
|
||||||
exitCode = admin.run(new String[] {"-safemode", "get"});
|
exitCode = admin.run(new String[] {"-safemode", "get"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
message = "Safe mode is ON in.*";
|
message = "Safe mode is ON in.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
|
|
||||||
// Leave safemode
|
// Leave safemode
|
||||||
exitCode = admin.run(new String[] {"-safemode", "leave"});
|
exitCode = admin.run(new String[] {"-safemode", "leave"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
message = "Safe mode is OFF in.*";
|
message = "Safe mode is OFF in.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
|
|
||||||
// Get safemode
|
// Get safemode
|
||||||
exitCode = admin.run(new String[] {"-safemode", "get"});
|
exitCode = admin.run(new String[] {"-safemode", "get"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
message = "Safe mode is OFF in.*";
|
message = "Safe mode is OFF in.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -136,12 +146,12 @@ public void testSaveNamespace() throws Exception {
|
|||||||
int exitCode = admin.run(new String[] {"-safemode", "enter"});
|
int exitCode = admin.run(new String[] {"-safemode", "enter"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "Safe mode is ON in.*";
|
String message = "Safe mode is ON in.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
|
|
||||||
exitCode = admin.run(new String[] {"-saveNamespace"});
|
exitCode = admin.run(new String[] {"-saveNamespace"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
message = "Save namespace successful for.*";
|
message = "Save namespace successful for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -151,17 +161,17 @@ public void testRestoreFailedStorage() throws Exception {
|
|||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "restoreFailedStorage is set to false for.*";
|
String message = "restoreFailedStorage is set to false for.*";
|
||||||
// Default is false
|
// Default is false
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
|
|
||||||
exitCode = admin.run(new String[] {"-restoreFailedStorage", "true"});
|
exitCode = admin.run(new String[] {"-restoreFailedStorage", "true"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
message = "restoreFailedStorage is set to true for.*";
|
message = "restoreFailedStorage is set to true for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
|
|
||||||
exitCode = admin.run(new String[] {"-restoreFailedStorage", "false"});
|
exitCode = admin.run(new String[] {"-restoreFailedStorage", "false"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
message = "restoreFailedStorage is set to false for.*";
|
message = "restoreFailedStorage is set to false for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -170,7 +180,7 @@ public void testRefreshNodes() throws Exception {
|
|||||||
int exitCode = admin.run(new String[] {"-refreshNodes"});
|
int exitCode = admin.run(new String[] {"-refreshNodes"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "Refresh nodes successful for.*";
|
String message = "Refresh nodes successful for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -179,7 +189,7 @@ public void testSetBalancerBandwidth() throws Exception {
|
|||||||
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.*";
|
String message = "Balancer bandwidth is set to 10 for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -189,7 +199,7 @@ public void testMetaSave() throws Exception {
|
|||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "Created metasave file dfs.meta in the log directory"
|
String message = "Created metasave file dfs.meta in the log directory"
|
||||||
+ " of namenode.*";
|
+ " of namenode.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -198,7 +208,7 @@ public void testRefreshServiceAcl() throws Exception {
|
|||||||
int exitCode = admin.run(new String[] {"-refreshServiceAcl"});
|
int exitCode = admin.run(new String[] {"-refreshServiceAcl"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "Refresh service acl successful for.*";
|
String message = "Refresh service acl successful for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -207,7 +217,7 @@ public void testRefreshUserToGroupsMappings() throws Exception {
|
|||||||
int exitCode = admin.run(new String[] {"-refreshUserToGroupsMappings"});
|
int exitCode = admin.run(new String[] {"-refreshUserToGroupsMappings"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "Refresh user to groups mapping successful for.*";
|
String message = "Refresh user to groups mapping successful for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -217,7 +227,7 @@ public void testRefreshSuperUserGroupsConfiguration() throws Exception {
|
|||||||
new String[] {"-refreshSuperUserGroupsConfiguration"});
|
new String[] {"-refreshSuperUserGroupsConfiguration"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "Refresh super user groups configuration successful for.*";
|
String message = "Refresh super user groups configuration successful for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout = 30000)
|
@Test (timeout = 30000)
|
||||||
@ -226,6 +236,6 @@ public void testRefreshCallQueue() throws Exception {
|
|||||||
int exitCode = admin.run(new String[] {"-refreshCallQueue"});
|
int exitCode = admin.run(new String[] {"-refreshCallQueue"});
|
||||||
assertEquals(err.toString().trim(), 0, exitCode);
|
assertEquals(err.toString().trim(), 0, exitCode);
|
||||||
String message = "Refresh call queue successful for.*";
|
String message = "Refresh call queue successful for.*";
|
||||||
assertOutputMatches(message + "\n" + message + "\n");
|
assertOutputMatches(message + newLine + message + newLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user