Преглед изворни кода

HDFS-9772. TestBlockReplacement#testThrottler doesn't work as expected. Contributed by Lin Yiqun.

(cherry picked from commit 903428bf946827b4d58c7c577ed0c574a7cff029)
Walter Su пре 9 година
родитељ
комит
c195b1c9fe

+ 1 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java

@@ -81,7 +81,6 @@ public class TestBlockReplacement {
     long bytesToSend = TOTAL_BYTES; 
     long bytesToSend = TOTAL_BYTES; 
     long start = Time.monotonicNow();
     long start = Time.monotonicNow();
     DataTransferThrottler throttler = new DataTransferThrottler(bandwidthPerSec);
     DataTransferThrottler throttler = new DataTransferThrottler(bandwidthPerSec);
-    long totalBytes = 0L;
     long bytesSent = 1024*512L; // 0.5MB
     long bytesSent = 1024*512L; // 0.5MB
     throttler.throttle(bytesSent);
     throttler.throttle(bytesSent);
     bytesToSend -= bytesSent;
     bytesToSend -= bytesSent;
@@ -93,7 +92,7 @@ public class TestBlockReplacement {
     } catch (InterruptedException ignored) {}
     } catch (InterruptedException ignored) {}
     throttler.throttle(bytesToSend);
     throttler.throttle(bytesToSend);
     long end = Time.monotonicNow();
     long end = Time.monotonicNow();
-    assertTrue(totalBytes*1000/(end-start)<=bandwidthPerSec);
+    assertTrue(TOTAL_BYTES * 1000 / (end - start) <= bandwidthPerSec);
   }
   }
   
   
   @Test
   @Test