diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestDiskFailures.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestDiskFailures.java index c7e34d87dda..bf82ec54a34 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestDiskFailures.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestDiskFailures.java @@ -244,7 +244,9 @@ public class TestDiskFailures { for (int i = 0; i < 10; i++) { Iterator iter = yarnCluster.getResourceManager().getRMContext() .getRMNodes().values().iterator(); - if ((iter.next().getState() != NodeState.UNHEALTHY) == isHealthy) { + // RMNode # might be zero because of timing related issue. + if (iter.hasNext() && + (iter.next().getState() != NodeState.UNHEALTHY) == isHealthy) { break; } // wait for the node health info to go to RM