HADOOP-13859. TestConfigurationFieldsBase fails for fields that are DEFAULT values of skipped properties. (Haibo Chen via kasha)

This commit is contained in:
Karthik Kambatla 2016-12-06 14:08:08 -08:00
parent da4ecc9f82
commit c8d0a049b0
3 changed files with 18 additions and 32 deletions

View File

@ -205,6 +205,12 @@ public abstract class TestConfigurationFieldsBase {
if (!f.getType().getName().equals("java.lang.String")) {
continue;
}
// filter out default-value fields
if (isFieldADefaultValue(f)) {
continue;
}
// Convert found member into String
try {
value = (String) f.get(null);
@ -331,6 +337,17 @@ public abstract class TestConfigurationFieldsBase {
return retVal;
}
/**
* Test if a field is a default value of another property by
* checking if its name starts with "DEFAULT_" or ends with
* "_DEFAULT".
* @param field the field to check
*/
private static boolean isFieldADefaultValue(Field field) {
return field.getName().startsWith("DEFAULT_") ||
field.getName().endsWith("_DEFAULT");
}
/**
* Utility function to extract "public static final" default
* member variables from a Configuration type class.
@ -363,8 +380,7 @@ public abstract class TestConfigurationFieldsBase {
}
// Special: Stuff any property beginning with "DEFAULT_" into a
// different hash for later processing
if (f.getName().startsWith("DEFAULT_") ||
f.getName().endsWith("_DEFAULT")) {
if (isFieldADefaultValue(f)) {
if (retVal.containsKey(f.getName())) {
continue;
}

View File

@ -57,12 +57,6 @@ public class TestHdfsConfigFields extends TestConfigurationFieldsBase {
// Remove deprecated properties listed in Configuration#DeprecationDelta
configurationPropsToSkipCompare.add(DFSConfigKeys.DFS_DF_INTERVAL_KEY);
// Remove default properties
configurationPropsToSkipCompare
.add(DFSConfigKeys.DFS_IMAGE_COMPRESSION_CODEC_DEFAULT);
configurationPropsToSkipCompare
.add(DFSConfigKeys.DFS_WEBHDFS_AUTHENTICATION_FILTER_DEFAULT);
// Remove support property
configurationPropsToSkipCompare
.add(DFSConfigKeys.DFS_NAMENODE_MIN_SUPPORTED_DATANODE_VERSION_KEY);

View File

@ -48,22 +48,6 @@ public class TestYarnConfigurationFields extends TestConfigurationFieldsBase {
errorIfMissingXmlProps = true;
// Specific properties to skip
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_FS_NODE_LABELS_STORE_IMPL_CLASS);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_RM_CONFIGURATION_PROVIDER_CLASS);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_CLIENT_FAILOVER_PROXY_PROVIDER);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_IPC_RECORD_FACTORY_CLASS);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_IPC_CLIENT_FACTORY_CLASS);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_IPC_SERVER_FACTORY_CLASS);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_IPC_RPC_IMPL);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_RM_SCHEDULER);
configurationPropsToSkipCompare
.add(YarnConfiguration
.YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONCLIENT_PROTOCOL);
@ -82,14 +66,6 @@ public class TestYarnConfigurationFields extends TestConfigurationFieldsBase {
configurationPropsToSkipCompare
.add(YarnConfiguration
.YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCETRACKER_PROTOCOL);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_SCM_STORE_CLASS);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_SCM_APP_CHECKER_CLASS);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_SHARED_CACHE_CHECKSUM_ALGO_IMPL);
configurationPropsToSkipCompare
.add(YarnConfiguration.DEFAULT_AMRM_PROXY_INTERCEPTOR_CLASS_PIPELINE);
configurationPropsToSkipCompare.add(YarnConfiguration.CURATOR_LEADER_ELECTOR);
// Ignore blacklisting nodes for AM failures feature since it is still a