Forráskód Böngészése

HDFS-9743. Fix TestLazyPersistFiles#testFallbackToDiskFull in branch-2.7. Contributed by Kihwal Lee.

(cherry picked from commit dd11c8274dede96a7687cc48edee5df8aa65c9b4)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
Xiao Chen 7 éve
szülő
commit
71c856225c

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -28,6 +28,8 @@ Release 2.6.6 - UNRELEASED
 
 
     HDFS-10270. TestJMXGet:testNameNode() fails. Contributed by Gergely Novák.
     HDFS-10270. TestJMXGet:testNameNode() fails. Contributed by Gergely Novák.
 
 
+    HDFS-9743. Fix TestLazyPersistFiles#testFallbackToDiskFull (kihwal)
+
 Release 2.6.5 - 2016-10-08
 Release 2.6.5 - 2016-10-08
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 7 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/LazyPersistTestCase.java

@@ -48,6 +48,7 @@ import org.junit.rules.Timeout;
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Arrays;
+import java.util.concurrent.TimeoutException;
 import java.util.EnumSet;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.List;
 import java.util.UUID;
 import java.util.UUID;
@@ -359,6 +360,7 @@ public abstract class LazyPersistTestCase {
 
 
   protected final void verifyRamDiskJMXMetric(String metricName,
   protected final void verifyRamDiskJMXMetric(String metricName,
       long expectedValue) throws Exception {
       long expectedValue) throws Exception {
+    waitForMetric(metricName, (int)expectedValue);
     assertEquals(expectedValue, Integer.parseInt(jmx.getValue(metricName)));
     assertEquals(expectedValue, Integer.parseInt(jmx.getValue(metricName)));
   }
   }
 
 
@@ -386,4 +388,9 @@ public abstract class LazyPersistTestCase {
       e.printStackTrace();
       e.printStackTrace();
     }
     }
   }
   }
+
+  protected void waitForMetric(final String metricName, final int expectedValue)
+      throws TimeoutException, InterruptedException {
+    DFSTestUtil.waitForMetric(jmx, metricName, expectedValue);
+  }
 }
 }