HDFS-5105. TestFsck fails on Windows. (Contributed by Chuan Liu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1514852 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8d21926c26
commit
218ea7380c
|
@ -353,6 +353,8 @@ Release 2.1.1-beta - UNRELEASED
|
||||||
HDFS-5102. Snapshot names should not be allowed to contain slash characters.
|
HDFS-5102. Snapshot names should not be allowed to contain slash characters.
|
||||||
(jing9)
|
(jing9)
|
||||||
|
|
||||||
|
HDFS-5105. TestFsck fails on Windows. (Chuan Liu via arp)
|
||||||
|
|
||||||
Release 2.1.0-beta - 2013-08-22
|
Release 2.1.0-beta - 2013-08-22
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -153,8 +153,8 @@ public class TestFsck {
|
||||||
String outStr = runFsck(conf, 0, true, "/");
|
String outStr = runFsck(conf, 0, true, "/");
|
||||||
verifyAuditLogs();
|
verifyAuditLogs();
|
||||||
assertEquals(aTime, fs.getFileStatus(file).getAccessTime());
|
assertEquals(aTime, fs.getFileStatus(file).getAccessTime());
|
||||||
assertTrue(outStr.contains(NamenodeFsck.HEALTHY_STATUS));
|
|
||||||
System.out.println(outStr);
|
System.out.println(outStr);
|
||||||
|
assertTrue(outStr.contains(NamenodeFsck.HEALTHY_STATUS));
|
||||||
if (fs != null) {try{fs.close();} catch(Exception e){}}
|
if (fs != null) {try{fs.close();} catch(Exception e){}}
|
||||||
cluster.shutdown();
|
cluster.shutdown();
|
||||||
|
|
||||||
|
@ -194,18 +194,30 @@ public class TestFsck {
|
||||||
// Turn off the logs
|
// Turn off the logs
|
||||||
Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
|
Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
|
||||||
logger.setLevel(Level.OFF);
|
logger.setLevel(Level.OFF);
|
||||||
|
|
||||||
// Audit log should contain one getfileinfo and one fsck
|
BufferedReader reader = null;
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(auditLogFile));
|
try {
|
||||||
String line = reader.readLine();
|
// Audit log should contain one getfileinfo and one fsck
|
||||||
assertNotNull(line);
|
reader = new BufferedReader(new FileReader(auditLogFile));
|
||||||
assertTrue("Expected getfileinfo event not found in audit log",
|
String line = reader.readLine();
|
||||||
getfileinfoPattern.matcher(line).matches());
|
assertNotNull(line);
|
||||||
line = reader.readLine();
|
assertTrue("Expected getfileinfo event not found in audit log",
|
||||||
assertNotNull(line);
|
getfileinfoPattern.matcher(line).matches());
|
||||||
assertTrue("Expected fsck event not found in audit log",
|
line = reader.readLine();
|
||||||
fsckPattern.matcher(line).matches());
|
assertNotNull(line);
|
||||||
assertNull("Unexpected event in audit log", reader.readLine());
|
assertTrue("Expected fsck event not found in audit log", fsckPattern
|
||||||
|
.matcher(line).matches());
|
||||||
|
assertNull("Unexpected event in audit log", reader.readLine());
|
||||||
|
} finally {
|
||||||
|
// Close the reader and remove the appender to release the audit log file
|
||||||
|
// handle after verifying the content of the file.
|
||||||
|
if (reader != null) {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
if (logger != null) {
|
||||||
|
logger.removeAllAppenders();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -963,9 +975,9 @@ public class TestFsck {
|
||||||
String outStr = runFsck(conf, 0, true, "/");
|
String outStr = runFsck(conf, 0, true, "/");
|
||||||
verifyAuditLogs();
|
verifyAuditLogs();
|
||||||
assertEquals(aTime, fc.getFileStatus(symlink).getAccessTime());
|
assertEquals(aTime, fc.getFileStatus(symlink).getAccessTime());
|
||||||
assertTrue(outStr.contains(NamenodeFsck.HEALTHY_STATUS));
|
|
||||||
assertTrue(outStr.contains("Total symlinks:\t\t1\n"));
|
|
||||||
System.out.println(outStr);
|
System.out.println(outStr);
|
||||||
|
assertTrue(outStr.contains(NamenodeFsck.HEALTHY_STATUS));
|
||||||
|
assertTrue(outStr.contains("Total symlinks:\t\t1"));
|
||||||
util.cleanup(fs, fileName);
|
util.cleanup(fs, fileName);
|
||||||
} finally {
|
} finally {
|
||||||
if (fs != null) {try{fs.close();} catch(Exception e){}}
|
if (fs != null) {try{fs.close();} catch(Exception e){}}
|
||||||
|
|
Loading…
Reference in New Issue