Repository: incubator-slider
Updated Branches:
  refs/heads/feature/SLIDER-622-windows c52493f94 -> 63148ffc4


SLIDER-623 cut back on disk capacity thresholds, probe for NM being unhealthy


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/7ec38593
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/7ec38593
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/7ec38593

Branch: refs/heads/feature/SLIDER-622-windows
Commit: 7ec38593ed1fd48e5804ef00e8e71e8656edbfce
Parents: 7974ffd
Author: Steve Loughran <[email protected]>
Authored: Mon Nov 10 16:03:58 2014 +0000
Committer: Steve Loughran <[email protected]>
Committed: Mon Nov 10 16:03:58 2014 +0000

----------------------------------------------------------------------
 .../slider/test/YarnMiniClusterTestBase.groovy  | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7ec38593/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
----------------------------------------------------------------------
diff --git 
a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
 
b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
index 73b81ab..eb7cfa2 100644
--- 
a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
+++ 
b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
@@ -26,6 +26,7 @@ import org.apache.hadoop.conf.Configuration
 import org.apache.hadoop.fs.FileSystem as HadoopFS
 import org.apache.hadoop.fs.FileUtil
 import org.apache.hadoop.fs.Path
+import org.apache.hadoop.hdfs.DFSConfigKeys
 import org.apache.hadoop.hdfs.MiniDFSCluster
 import org.apache.hadoop.service.ServiceOperations
 import org.apache.hadoop.yarn.api.records.ApplicationReport
@@ -245,6 +246,7 @@ public abstract class YarnMiniClusterTestBase extends 
ServiceLauncherBaseTest {
     assertNativeLibrariesPresent();
     conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 64);
     conf.set(YarnConfiguration.RM_SCHEDULER, FIFO_SCHEDULER);
+    patchDiskCapacityLimits(conf)
     SliderUtils.patchConfiguration(conf)
     name = buildClustername(name)
     miniCluster = new MiniYARNCluster(
@@ -254,12 +256,32 @@ public abstract class YarnMiniClusterTestBase extends 
ServiceLauncherBaseTest {
         numLogDirs)
     miniCluster.init(conf)
     miniCluster.start();
+    // health check
+    assertMiniClusterDisksHealthy(miniCluster)
     if (startHDFS) {
       createMiniHDFSCluster(name, conf)
     }
     return name
   }
 
+  public patchDiskCapacityLimits(YarnConfiguration conf) {
+    conf.setFloat(
+        YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE,
+        99.0f)
+    conf.setInt(DFSConfigKeys.DFS_NAMENODE_DU_RESERVED_KEY, 2 * 1024 * 1024)
+  }
+
+  /**
+   * Probe for the disks being healthy in a mini cluster. Only the first
+   * NM is checked
+   * @param miniCluster
+   */
+  public static void assertMiniClusterDisksHealthy(MiniYARNCluster 
miniCluster) {
+    def healthy = miniCluster.getNodeManager(
+        0).nodeHealthChecker.diskHandler.areDisksHealthy()
+    assert healthy, "Disks on test cluster unhealthy —may be full"
+  }
+
   /**
    * Create a mini HDFS cluster and save it to the hdfsClusterField
    * @param name

Reply via email to