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:
parent
96fc01fbc2
commit
97605f27e7
@ -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
|
||||
|
@ -42,6 +42,15 @@ public void testProxyUserFromEnvironment() throws IOException {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user