HDFS-13619. TestAuditLoggerWithCommands fails on Windows. Contributed by Anbang Hu.

This commit is contained in:
Inigo Goiri 2018-05-25 13:32:34 -07:00
parent 8733012ae3
commit 13d2528907

View File

@ -1264,8 +1264,9 @@ private void verifySafeModeAction(
} }
private int verifyAuditLogs(String pattern) { private int verifyAuditLogs(String pattern) {
int length = auditlog.getOutput().split("\n").length; int length = auditlog.getOutput().split(System.lineSeparator()).length;
String lastAudit = auditlog.getOutput().split("\n")[length - 1]; String lastAudit = auditlog.getOutput()
.split(System.lineSeparator())[length - 1];
assertTrue("Unexpected log!", lastAudit.matches(pattern)); assertTrue("Unexpected log!", lastAudit.matches(pattern));
return length; return length;
} }