diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java index 8e1e23673af..027e9fb3d77 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeMultipleRegistrations.java @@ -250,7 +250,7 @@ public void testClusterIdMismatchAtStartupWithHA() throws Exception { try { cluster.startDataNodes(conf, 1, true, null, null); // let the initialization be complete - Thread.sleep(10000); + cluster.waitActive(); DataNode dn = cluster.getDataNodes().get(0); assertTrue("Datanode should be running", dn.isDatanodeUp()); assertEquals("Only one BPOfferService should be running", 1, @@ -274,7 +274,7 @@ public void testDNWithInvalidStorageWithHA() throws Exception { try { cluster.startDataNodes(conf, 1, true, null, null); // let the initialization be complete - Thread.sleep(10000); + cluster.waitActive(); DataNode dn = cluster.getDataNodes().get(0); assertTrue("Datanode should be running", dn.isDatanodeUp()); assertEquals("BPOfferService should be running", 1,