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
This commit is contained in:
Arpit Agarwal 2014-03-12 23:24:32 +00:00
parent 20ec0c0474
commit f0fa038c7e
2 changed files with 8 additions and 9 deletions

View File

@ -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)

View File

@ -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<DelegationTokenIdentifier> 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)