YARN-32. Fix TestApplicationTokens to not depend on test order and thus pass on JDK7. Contributed by Vinod Kumar Vavilapalli.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1399795 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4d5600f6c7
commit
6cfa710bad
@ -151,6 +151,9 @@ Release 0.23.5 - UNRELEASED
|
|||||||
YARN-43. Fix TestResourceTrackerService to not depend on test order and thus
|
YARN-43. Fix TestResourceTrackerService to not depend on test order and thus
|
||||||
pass on JDK7. (Thomas Graves via vinodkv)
|
pass on JDK7. (Thomas Graves via vinodkv)
|
||||||
|
|
||||||
|
YARN-32. Fix TestApplicationTokens to not depend on test order and thus pass
|
||||||
|
on JDK7. (vinodkv)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
@ -64,6 +64,10 @@ public void testTokenExpiry() throws Exception {
|
|||||||
final MockRM rm = new MockRMWithAMS(new Configuration(), containerManager);
|
final MockRM rm = new MockRMWithAMS(new Configuration(), containerManager);
|
||||||
rm.start();
|
rm.start();
|
||||||
|
|
||||||
|
final Configuration conf = rm.getConfig();
|
||||||
|
final YarnRPC rpc = YarnRPC.create(conf);
|
||||||
|
AMRMProtocol rmClient = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MockNM nm1 = rm.registerNode("localhost:1234", 5120);
|
MockNM nm1 = rm.registerNode("localhost:1234", 5120);
|
||||||
|
|
||||||
@ -82,9 +86,6 @@ public void testTokenExpiry() throws Exception {
|
|||||||
ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId();
|
ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId();
|
||||||
|
|
||||||
// Create a client to the RM.
|
// Create a client to the RM.
|
||||||
final Configuration conf = rm.getConfig();
|
|
||||||
final YarnRPC rpc = YarnRPC.create(conf);
|
|
||||||
|
|
||||||
UserGroupInformation currentUser =
|
UserGroupInformation currentUser =
|
||||||
UserGroupInformation
|
UserGroupInformation
|
||||||
.createRemoteUser(applicationAttemptId.toString());
|
.createRemoteUser(applicationAttemptId.toString());
|
||||||
@ -96,7 +97,7 @@ public void testTokenExpiry() throws Exception {
|
|||||||
token.decodeFromUrlString(tokenURLEncodedStr);
|
token.decodeFromUrlString(tokenURLEncodedStr);
|
||||||
currentUser.addToken(token);
|
currentUser.addToken(token);
|
||||||
|
|
||||||
AMRMProtocol rmClient = createRMClient(rm, conf, rpc, currentUser);
|
rmClient = createRMClient(rm, conf, rpc, currentUser);
|
||||||
|
|
||||||
RegisterApplicationMasterRequest request =
|
RegisterApplicationMasterRequest request =
|
||||||
Records.newRecord(RegisterApplicationMasterRequest.class);
|
Records.newRecord(RegisterApplicationMasterRequest.class);
|
||||||
@ -136,6 +137,9 @@ public void testTokenExpiry() throws Exception {
|
|||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
rm.stop();
|
rm.stop();
|
||||||
|
if (rmClient != null) {
|
||||||
|
rpc.stopProxy(rmClient, conf); // To avoid using cached client
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,6 +157,10 @@ public void testMasterKeyRollOver() throws Exception {
|
|||||||
final MockRM rm = new MockRMWithAMS(config, containerManager);
|
final MockRM rm = new MockRMWithAMS(config, containerManager);
|
||||||
rm.start();
|
rm.start();
|
||||||
|
|
||||||
|
final Configuration conf = rm.getConfig();
|
||||||
|
final YarnRPC rpc = YarnRPC.create(conf);
|
||||||
|
AMRMProtocol rmClient = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MockNM nm1 = rm.registerNode("localhost:1234", 5120);
|
MockNM nm1 = rm.registerNode("localhost:1234", 5120);
|
||||||
|
|
||||||
@ -171,9 +179,6 @@ public void testMasterKeyRollOver() throws Exception {
|
|||||||
ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId();
|
ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId();
|
||||||
|
|
||||||
// Create a client to the RM.
|
// Create a client to the RM.
|
||||||
final Configuration conf = rm.getConfig();
|
|
||||||
final YarnRPC rpc = YarnRPC.create(conf);
|
|
||||||
|
|
||||||
UserGroupInformation currentUser =
|
UserGroupInformation currentUser =
|
||||||
UserGroupInformation
|
UserGroupInformation
|
||||||
.createRemoteUser(applicationAttemptId.toString());
|
.createRemoteUser(applicationAttemptId.toString());
|
||||||
@ -185,7 +190,7 @@ public void testMasterKeyRollOver() throws Exception {
|
|||||||
token.decodeFromUrlString(tokenURLEncodedStr);
|
token.decodeFromUrlString(tokenURLEncodedStr);
|
||||||
currentUser.addToken(token);
|
currentUser.addToken(token);
|
||||||
|
|
||||||
AMRMProtocol rmClient = createRMClient(rm, conf, rpc, currentUser);
|
rmClient = createRMClient(rm, conf, rpc, currentUser);
|
||||||
|
|
||||||
RegisterApplicationMasterRequest request =
|
RegisterApplicationMasterRequest request =
|
||||||
Records.newRecord(RegisterApplicationMasterRequest.class);
|
Records.newRecord(RegisterApplicationMasterRequest.class);
|
||||||
@ -217,6 +222,9 @@ public void testMasterKeyRollOver() throws Exception {
|
|||||||
.getReboot());
|
.getReboot());
|
||||||
} finally {
|
} finally {
|
||||||
rm.stop();
|
rm.stop();
|
||||||
|
if (rmClient != null) {
|
||||||
|
rpc.stopProxy(rmClient, conf); // To avoid using cached client
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user