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


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c8d0a049
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c8d0a049
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c8d0a049

Branch: refs/heads/YARN-5734
Commit: c8d0a049b00536385f06fad412a2288f005bf2ce
Parents: da4ecc9
Author: Karthik Kambatla <ka...@cloudera.com>
Authored: Tue Dec 6 14:08:08 2016 -0800
Committer: Karthik Kambatla <ka...@cloudera.com>
Committed: Tue Dec 6 14:10:58 2016 -0800

----------------------------------------------------------------------
 .../conf/TestConfigurationFieldsBase.java       | 20 ++++++++++++++--
 .../hadoop/tools/TestHdfsConfigFields.java      |  6 -----
 .../yarn/conf/TestYarnConfigurationFields.java  | 24 --------------------
 3 files changed, 18 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c8d0a049/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java
----------------------------------------------------------------------
diff --git 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java
 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java
index 9007c20..2367f21 100644
--- 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java
+++ 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigurationFieldsBase.java
@@ -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);
@@ -332,6 +338,17 @@ public abstract class TestConfigurationFieldsBase {
   }
 
   /**
+   * 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 &quot;public static final&quot; 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;
         }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c8d0a049/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java
index 3bbb609..a089d39 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java
@@ -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);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c8d0a049/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java
index db9364a..3da4bab 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/test/java/org/apache/hadoop/yarn/conf/TestYarnConfigurationFields.java
@@ -49,22 +49,6 @@ public class TestYarnConfigurationFields extends 
TestConfigurationFieldsBase {
 
     // 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);
     configurationPropsToSkipCompare
@@ -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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to