HDFS-6802. Some tests in TestDFSClientFailover are missing @Test annotation. Contributed by Akira Ajisaka.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1615183 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Wang 2014-08-01 17:58:14 +00:00
parent ce9aae4a52
commit da2ce46fbe
3 changed files with 16 additions and 1 deletions

View File

@ -77,7 +77,8 @@ public class SecurityUtil {
* For use only by tests and initialization * For use only by tests and initialization
*/ */
@InterfaceAudience.Private @InterfaceAudience.Private
static void setTokenServiceUseIp(boolean flag) { @VisibleForTesting
public static void setTokenServiceUseIp(boolean flag) {
useIpForTokenService = flag; useIpForTokenService = flag;
hostResolver = !useIpForTokenService hostResolver = !useIpForTokenService
? new QualifiedHostResolver() ? new QualifiedHostResolver()

View File

@ -346,6 +346,9 @@ Release 2.6.0 - UNRELEASED
HDFS-6794. Update BlockManager methods to use DatanodeStorageInfo HDFS-6794. Update BlockManager methods to use DatanodeStorageInfo
where possible (Arpit Agarwal) where possible (Arpit Agarwal)
HDFS-6802. Some tests in TestDFSClientFailover are missing @Test
annotation. (Akira Ajisaka via wang)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-6690. Deduplicate xattr names in memory. (wang) HDFS-6690. Deduplicate xattr names in memory. (wang)

View File

@ -52,6 +52,7 @@ import org.apache.hadoop.io.retry.DefaultFailoverProxyProvider;
import org.apache.hadoop.io.retry.FailoverProxyProvider; import org.apache.hadoop.io.retry.FailoverProxyProvider;
import org.apache.hadoop.net.ConnectTimeoutException; import org.apache.hadoop.net.ConnectTimeoutException;
import org.apache.hadoop.net.StandardSocketFactory; import org.apache.hadoop.net.StandardSocketFactory;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
@ -89,6 +90,11 @@ public class TestDFSClientFailover {
cluster.shutdown(); cluster.shutdown();
} }
@After
public void clearConfig() {
SecurityUtil.setTokenServiceUseIp(true);
}
/** /**
* Make sure that client failover works when an active NN dies and the standby * Make sure that client failover works when an active NN dies and the standby
* takes over. * takes over.
@ -323,6 +329,7 @@ public class TestDFSClientFailover {
/** /**
* Test to verify legacy proxy providers are correctly wrapped. * Test to verify legacy proxy providers are correctly wrapped.
*/ */
@Test
public void testWrappedFailoverProxyProvider() throws Exception { public void testWrappedFailoverProxyProvider() throws Exception {
// setup the config with the dummy provider class // setup the config with the dummy provider class
Configuration config = new HdfsConfiguration(conf); Configuration config = new HdfsConfiguration(conf);
@ -332,6 +339,9 @@ public class TestDFSClientFailover {
DummyLegacyFailoverProxyProvider.class.getName()); DummyLegacyFailoverProxyProvider.class.getName());
Path p = new Path("hdfs://" + logicalName + "/"); Path p = new Path("hdfs://" + logicalName + "/");
// not to use IP address for token service
SecurityUtil.setTokenServiceUseIp(false);
// Logical URI should be used. // Logical URI should be used.
assertTrue("Legacy proxy providers should use logical URI.", assertTrue("Legacy proxy providers should use logical URI.",
HAUtil.useLogicalUri(config, p.toUri())); HAUtil.useLogicalUri(config, p.toUri()));
@ -340,6 +350,7 @@ public class TestDFSClientFailover {
/** /**
* Test to verify IPFailoverProxyProvider is not requiring logical URI. * Test to verify IPFailoverProxyProvider is not requiring logical URI.
*/ */
@Test
public void testIPFailoverProxyProviderLogicalUri() throws Exception { public void testIPFailoverProxyProviderLogicalUri() throws Exception {
// setup the config with the IP failover proxy provider class // setup the config with the IP failover proxy provider class
Configuration config = new HdfsConfiguration(conf); Configuration config = new HdfsConfiguration(conf);