HDFS-9362. TestAuditLogger#testAuditLoggerWithCallContext assumes Unix line endings, fails on Windows. Contributed by Chris Nauroth.
This commit is contained in:
parent
095ac83402
commit
7e2829662b
@ -2222,6 +2222,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
HDFS-9354. Fix TestBalancer#testBalancerWithZeroThreadsForMove on Windows.
|
HDFS-9354. Fix TestBalancer#testBalancerWithZeroThreadsForMove on Windows.
|
||||||
(Xiaoyu Yao via cnauroth)
|
(Xiaoyu Yao via cnauroth)
|
||||||
|
|
||||||
|
HDFS-9362. TestAuditLogger#testAuditLoggerWithCallContext assumes Unix line
|
||||||
|
endings, fails on Windows. (cnauroth)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -243,7 +243,8 @@ public void testAuditLoggerWithCallContext() throws IOException {
|
|||||||
CallerContext.setCurrent(context);
|
CallerContext.setCurrent(context);
|
||||||
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
||||||
fs.setTimes(p, time, time);
|
fs.setTimes(p, time, time);
|
||||||
assertTrue(auditlog.getOutput().endsWith("callerContext=setTimes\n"));
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
|
String.format("callerContext=setTimes%n")));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// context with signature
|
// context with signature
|
||||||
@ -254,7 +255,7 @@ public void testAuditLoggerWithCallContext() throws IOException {
|
|||||||
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
||||||
fs.setTimes(p, time, time);
|
fs.setTimes(p, time, time);
|
||||||
assertTrue(auditlog.getOutput().endsWith(
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
"callerContext=setTimes:L\n"));
|
String.format("callerContext=setTimes:L%n")));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// long context is truncated
|
// long context is truncated
|
||||||
@ -266,7 +267,7 @@ public void testAuditLoggerWithCallContext() throws IOException {
|
|||||||
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
||||||
fs.setTimes(p, time, time);
|
fs.setTimes(p, time, time);
|
||||||
assertTrue(auditlog.getOutput().endsWith(
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
"callerContext=" + longContext.substring(0, 128) + ":L\n"));
|
String.format("callerContext=%s:L%n", longContext.substring(0, 128))));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// empty context is ignored
|
// empty context is ignored
|
||||||
@ -302,7 +303,8 @@ public void run() {
|
|||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
assertTrue(auditlog.getOutput().endsWith("callerContext=setTimes:L\n"));
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
|
String.format("callerContext=setTimes:L%n")));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// caller context is overridden in child thread
|
// caller context is overridden in child thread
|
||||||
@ -330,7 +332,7 @@ public void run() {
|
|||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
assertTrue(auditlog.getOutput().endsWith(
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
"callerContext=setPermission:L\n"));
|
String.format("callerContext=setPermission:L%n")));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// reuse the current context's signature
|
// reuse the current context's signature
|
||||||
@ -339,7 +341,8 @@ public void run() {
|
|||||||
CallerContext.setCurrent(context);
|
CallerContext.setCurrent(context);
|
||||||
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
||||||
fs.mkdirs(new Path("/reuse-context-signature"));
|
fs.mkdirs(new Path("/reuse-context-signature"));
|
||||||
assertTrue(auditlog.getOutput().endsWith("callerContext=mkdirs:L\n"));
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
|
String.format("callerContext=mkdirs:L%n")));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// too long signature is ignored
|
// too long signature is ignored
|
||||||
@ -349,7 +352,8 @@ public void run() {
|
|||||||
CallerContext.setCurrent(context);
|
CallerContext.setCurrent(context);
|
||||||
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
||||||
fs.setTimes(p, time, time);
|
fs.setTimes(p, time, time);
|
||||||
assertTrue(auditlog.getOutput().endsWith("callerContext=setTimes\n"));
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
|
String.format("callerContext=setTimes%n")));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// null signature is ignored
|
// null signature is ignored
|
||||||
@ -358,7 +362,8 @@ public void run() {
|
|||||||
CallerContext.setCurrent(context);
|
CallerContext.setCurrent(context);
|
||||||
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
||||||
fs.setTimes(p, time, time);
|
fs.setTimes(p, time, time);
|
||||||
assertTrue(auditlog.getOutput().endsWith("callerContext=setTimes\n"));
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
|
String.format("callerContext=setTimes%n")));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// empty signature is ignored
|
// empty signature is ignored
|
||||||
@ -368,7 +373,8 @@ public void run() {
|
|||||||
CallerContext.setCurrent(context);
|
CallerContext.setCurrent(context);
|
||||||
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
LOG.info("Set current caller context as {}", CallerContext.getCurrent());
|
||||||
fs.mkdirs(new Path("/empty-signature"));
|
fs.mkdirs(new Path("/empty-signature"));
|
||||||
assertTrue(auditlog.getOutput().endsWith("callerContext=mkdirs\n"));
|
assertTrue(auditlog.getOutput().endsWith(
|
||||||
|
String.format("callerContext=mkdirs%n")));
|
||||||
auditlog.clearOutput();
|
auditlog.clearOutput();
|
||||||
|
|
||||||
// invalid context is not passed to the rpc
|
// invalid context is not passed to the rpc
|
||||||
|
Loading…
Reference in New Issue
Block a user