HADOOP-9376. TestProxyUserFromEnv fails on a Windows domain joined machine. Contributed by Ivan Mitic.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1453675 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2013-03-07 03:34:44 +00:00
parent 96fc01fbc2
commit 97605f27e7
2 changed files with 12 additions and 0 deletions

View File

@ -456,6 +456,9 @@ Trunk (Unreleased)
HADOOP-9372. Fix bad timeout annotations on tests.
(Arpit Agarwal via suresh)
HADOOP-9376. TestProxyUserFromEnv fails on a Windows domain joined machine.
(Ivan Mitic via suresh)
Release 2.0.4-beta - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -42,6 +42,15 @@ public class TestProxyUserFromEnv {
BufferedReader br = new BufferedReader
(new InputStreamReader(pp.getInputStream()));
String realUser = br.readLine().trim();
// On Windows domain joined machine, whoami returns the username
// in the DOMAIN\\username format, so we trim the domain part before
// the comparison. We don't have to special case for Windows
// given that Unix systems do not allow slashes in usernames.
int backslashIndex = realUser.indexOf('\\');
if (backslashIndex != -1) {
realUser = realUser.substring(backslashIndex + 1);
}
assertEquals(realUser, realUgi.getUserName());
}
}