From f0fa038c7ebff7248ddca958a6a9f21c108f363b Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Wed, 12 Mar 2014 23:24:32 +0000 Subject: [PATCH] HDFS-6096. TestWebHdfsTokens may timeout. (Contributed by szetszwo) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1576999 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../apache/hadoop/hdfs/web/TestWebHdfsTokens.java | 15 ++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 5151f6563bb..a0b97cfc459 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -603,6 +603,8 @@ Release 2.4.0 - UNRELEASED HDFS-5705. TestSecondaryNameNodeUpgrade#testChangeNsIDFails may fail due to ConcurrentModificationException. (Ted Yu via brandonli) + HDFS-6096. TestWebHdfsTokens may timeout. (szetszwo via Arpit Agarwal) + BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTokens.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTokens.java index e649da3c285..2b3685e9d81 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTokens.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTokens.java @@ -33,7 +33,6 @@ import java.io.IOException; import java.net.URI; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier; import org.apache.hadoop.hdfs.web.resources.DeleteOpParam; import org.apache.hadoop.hdfs.web.resources.GetOpParam; import org.apache.hadoop.hdfs.web.resources.HttpOpParam; @@ -64,11 +63,10 @@ public class TestWebHdfsTokens { return fs; } - @SuppressWarnings("unchecked") - @Test(timeout = 1000) + @Test(timeout = 5000) public void testTokenForNonTokenOp() throws IOException { WebHdfsFileSystem fs = spyWebhdfsInSecureSetup(); - Token token = mock(Token.class); + Token token = mock(Token.class); doReturn(token).when(fs).getDelegationToken(null); // should get/set/renew token @@ -85,22 +83,21 @@ public class TestWebHdfsTokens { verify(fs, never()).setDelegationToken(token); } - @Test(timeout = 1000) + @Test(timeout = 5000) public void testNoTokenForGetToken() throws IOException { checkNoTokenForOperation(GetOpParam.Op.GETDELEGATIONTOKEN); } - @Test(timeout = 1000) + @Test(timeout = 5000) public void testNoTokenForCanclToken() throws IOException { checkNoTokenForOperation(PutOpParam.Op.RENEWDELEGATIONTOKEN); } - @Test(timeout = 1000) + @Test(timeout = 5000) public void testNoTokenForCancelToken() throws IOException { checkNoTokenForOperation(PutOpParam.Op.CANCELDELEGATIONTOKEN); } - @SuppressWarnings("unchecked") private void checkNoTokenForOperation(HttpOpParam.Op op) throws IOException { WebHdfsFileSystem fs = spyWebhdfsInSecureSetup(); doReturn(null).when(fs).getDelegationToken(null); @@ -110,7 +107,7 @@ public class TestWebHdfsTokens { fs.toUrl(op, null); verify(fs, never()).getDelegationToken(); verify(fs, never()).getDelegationToken(null); - verify(fs, never()).setDelegationToken(any(Token.class)); + verify(fs, never()).setDelegationToken((Token)any(Token.class)); } @Test(timeout = 1000)