You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ay...@apache.org on 2022/06/20 06:55:07 UTC
[hadoop] branch branch-3.3 updated: MAPREDUCE-7387. Fix TestJHSSecurity#testDelegationToken AssertionError due to HDFS-16563 (#4428). Contributed by fanshilun.
This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new 43f4a0e92d5 MAPREDUCE-7387. Fix TestJHSSecurity#testDelegationToken AssertionError due to HDFS-16563 (#4428). Contributed by fanshilun.
43f4a0e92d5 is described below
commit 43f4a0e92d5426c93d3f2c6f97347d06a7a67684
Author: slfan1989 <55...@users.noreply.github.com>
AuthorDate: Sun Jun 19 23:44:04 2022 -0700
MAPREDUCE-7387. Fix TestJHSSecurity#testDelegationToken AssertionError due to HDFS-16563 (#4428). Contributed by fanshilun.
Signed-off-by: Ayush Saxena <ay...@apache.org>
---
.../hadoop/mapreduce/security/TestJHSSecurity.java | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/security/TestJHSSecurity.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/security/TestJHSSecurity.java
index 6115c590d5f..9e58d460d17 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/security/TestJHSSecurity.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/security/TestJHSSecurity.java
@@ -18,7 +18,6 @@
package org.apache.hadoop.mapreduce.security;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
@@ -26,6 +25,8 @@ import java.net.InetSocketAddress;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
+import org.apache.hadoop.security.token.SecretManager;
+import org.apache.hadoop.test.LambdaTestUtils;
import org.junit.Assert;
import org.apache.hadoop.conf.Configuration;
@@ -61,7 +62,7 @@ public class TestJHSSecurity {
LoggerFactory.getLogger(TestJHSSecurity.class);
@Test
- public void testDelegationToken() throws IOException, InterruptedException {
+ public void testDelegationToken() throws Exception {
org.apache.log4j.Logger rootLogger = LogManager.getRootLogger();
rootLogger.setLevel(Level.DEBUG);
@@ -80,7 +81,7 @@ public class TestJHSSecurity {
final long renewInterval = 10000l;
JobHistoryServer jobHistoryServer = null;
- MRClientProtocol clientUsingDT = null;
+ MRClientProtocol clientUsingDT;
long tokenFetchTime;
try {
jobHistoryServer = new JobHistoryServer() {
@@ -155,14 +156,11 @@ public class TestJHSSecurity {
}
Thread.sleep(50l);
LOG.info("At time: " + System.currentTimeMillis() + ", token should be invalid");
- // Token should have expired.
- try {
- clientUsingDT.getJobReport(jobReportRequest);
- fail("Should not have succeeded with an expired token");
- } catch (IOException e) {
- assertTrue(e.getCause().getMessage().contains("is expired"));
- }
-
+ // Token should have expired.
+ final MRClientProtocol finalClientUsingDT = clientUsingDT;
+ LambdaTestUtils.intercept(SecretManager.InvalidToken.class, "has expired",
+ () -> finalClientUsingDT.getJobReport(jobReportRequest));
+
// Test cancellation
// Stop the existing proxy, start another.
if (clientUsingDT != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org