YARN-2747. Fixed the test failure of TestAggregatedLogFormat when native I/O is enabled. Contributed by Xuan Gong.

This commit is contained in:
Zhijie Shen 2014-10-28 22:43:40 -07:00
parent 3c5f5af118
commit ec63a3ffbd
2 changed files with 10 additions and 5 deletions

View File

@ -789,6 +789,9 @@ Release 2.6.0 - UNRELEASED
YARN-2741. Made NM web UI serve logs on the drive other than C: on Windows. (Craig YARN-2741. Made NM web UI serve logs on the drive other than C: on Windows. (Craig
Welch via zjshen) Welch via zjshen)
YARN-2747. Fixed the test failure of TestAggregatedLogFormat when native I/O is
enabled. (Xuan Gong via zjshen)
Release 2.5.1 - 2014-09-05 Release 2.5.1 - 2014-09-05
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -305,6 +305,8 @@ public void testContainerLogsFileAccess() throws IOException {
// It is trying simulate a situation where first log file is owned by // It is trying simulate a situation where first log file is owned by
// different user (probably symlink) and second one by the user itself. // different user (probably symlink) and second one by the user itself.
// The first file should not be aggregated. Because this log file has the invalid
// user name.
when(logValue.getUser()).thenReturn(randomUser).thenReturn( when(logValue.getUser()).thenReturn(randomUser).thenReturn(
ugi.getShortUserName()); ugi.getShortUserName());
logWriter.append(logKey, logValue); logWriter.append(logKey, logValue);
@ -329,6 +331,9 @@ public void testContainerLogsFileAccess() throws IOException {
expectedOwner = adminsGroupString; expectedOwner = adminsGroupString;
} }
} }
// This file: stderr should not be aggregated.
// And we will not aggregate the log message.
String stdoutFile1 = String stdoutFile1 =
StringUtils.join( StringUtils.join(
File.separator, File.separator,
@ -336,10 +341,8 @@ public void testContainerLogsFileAccess() throws IOException {
workDir.getAbsolutePath(), "srcFiles", workDir.getAbsolutePath(), "srcFiles",
testContainerId1.getApplicationAttemptId().getApplicationId() testContainerId1.getApplicationAttemptId().getApplicationId()
.toString(), testContainerId1.toString(), stderr })); .toString(), testContainerId1.toString(), stderr }));
String message1 =
"Owner '" + expectedOwner + "' for path " + stdoutFile1 // The file: stdout is expected to be aggregated.
+ " did not match expected owner '" + randomUser + "'";
String stdoutFile2 = String stdoutFile2 =
StringUtils.join( StringUtils.join(
File.separator, File.separator,
@ -352,7 +355,6 @@ public void testContainerLogsFileAccess() throws IOException {
+ stdoutFile2 + " did not match expected owner '" + stdoutFile2 + " did not match expected owner '"
+ ugi.getShortUserName() + "'"; + ugi.getShortUserName() + "'";
Assert.assertTrue(line.contains(message1));
Assert.assertFalse(line.contains(message2)); Assert.assertFalse(line.contains(message2));
Assert.assertFalse(line.contains(data + testContainerId1.toString() Assert.assertFalse(line.contains(data + testContainerId1.toString()
+ stderr)); + stderr));