HDFS-6096. Merging r1576999 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1577000 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arpit Agarwal 2014-03-12 23:25:28 +00:00
parent 9127f3c1dc
commit 502a0da830
2 changed files with 8 additions and 9 deletions

View File

@ -362,6 +362,8 @@ Release 2.4.0 - UNRELEASED
HDFS-5705. TestSecondaryNameNodeUpgrade#testChangeNsIDFails may fail due HDFS-5705. TestSecondaryNameNodeUpgrade#testChangeNsIDFails may fail due
to ConcurrentModificationException. (Ted Yu via brandonli) to ConcurrentModificationException. (Ted Yu via brandonli)
HDFS-6096. TestWebHdfsTokens may timeout. (szetszwo via Arpit Agarwal)
BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS
HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9) HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9)

View File

@ -33,7 +33,6 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import org.apache.hadoop.conf.Configuration; 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.DeleteOpParam;
import org.apache.hadoop.hdfs.web.resources.GetOpParam; import org.apache.hadoop.hdfs.web.resources.GetOpParam;
import org.apache.hadoop.hdfs.web.resources.HttpOpParam; import org.apache.hadoop.hdfs.web.resources.HttpOpParam;
@ -64,11 +63,10 @@ public class TestWebHdfsTokens {
return fs; return fs;
} }
@SuppressWarnings("unchecked") @Test(timeout = 5000)
@Test(timeout = 1000)
public void testTokenForNonTokenOp() throws IOException { public void testTokenForNonTokenOp() throws IOException {
WebHdfsFileSystem fs = spyWebhdfsInSecureSetup(); WebHdfsFileSystem fs = spyWebhdfsInSecureSetup();
Token<DelegationTokenIdentifier> token = mock(Token.class); Token<?> token = mock(Token.class);
doReturn(token).when(fs).getDelegationToken(null); doReturn(token).when(fs).getDelegationToken(null);
// should get/set/renew token // should get/set/renew token
@ -85,22 +83,21 @@ public class TestWebHdfsTokens {
verify(fs, never()).setDelegationToken(token); verify(fs, never()).setDelegationToken(token);
} }
@Test(timeout = 1000) @Test(timeout = 5000)
public void testNoTokenForGetToken() throws IOException { public void testNoTokenForGetToken() throws IOException {
checkNoTokenForOperation(GetOpParam.Op.GETDELEGATIONTOKEN); checkNoTokenForOperation(GetOpParam.Op.GETDELEGATIONTOKEN);
} }
@Test(timeout = 1000) @Test(timeout = 5000)
public void testNoTokenForCanclToken() throws IOException { public void testNoTokenForCanclToken() throws IOException {
checkNoTokenForOperation(PutOpParam.Op.RENEWDELEGATIONTOKEN); checkNoTokenForOperation(PutOpParam.Op.RENEWDELEGATIONTOKEN);
} }
@Test(timeout = 1000) @Test(timeout = 5000)
public void testNoTokenForCancelToken() throws IOException { public void testNoTokenForCancelToken() throws IOException {
checkNoTokenForOperation(PutOpParam.Op.CANCELDELEGATIONTOKEN); checkNoTokenForOperation(PutOpParam.Op.CANCELDELEGATIONTOKEN);
} }
@SuppressWarnings("unchecked")
private void checkNoTokenForOperation(HttpOpParam.Op op) throws IOException { private void checkNoTokenForOperation(HttpOpParam.Op op) throws IOException {
WebHdfsFileSystem fs = spyWebhdfsInSecureSetup(); WebHdfsFileSystem fs = spyWebhdfsInSecureSetup();
doReturn(null).when(fs).getDelegationToken(null); doReturn(null).when(fs).getDelegationToken(null);
@ -110,7 +107,7 @@ public class TestWebHdfsTokens {
fs.toUrl(op, null); fs.toUrl(op, null);
verify(fs, never()).getDelegationToken(); verify(fs, never()).getDelegationToken();
verify(fs, never()).getDelegationToken(null); verify(fs, never()).getDelegationToken(null);
verify(fs, never()).setDelegationToken(any(Token.class)); verify(fs, never()).setDelegationToken((Token<?>)any(Token.class));
} }
@Test(timeout = 1000) @Test(timeout = 1000)