From 2ee244ac28f2802aa10ce428779d9816785e1b66 Mon Sep 17 00:00:00 2001 From: Walter Su Date: Wed, 13 Apr 2016 17:49:45 +0800 Subject: [PATCH] HDFS-9772. TestBlockReplacement#testThrottler doesn't work as expected. Contributed by Lin Yiqun. (cherry picked from commit 903428bf946827b4d58c7c577ed0c574a7cff029) --- .../hadoop/hdfs/server/datanode/TestBlockReplacement.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java index bf0f96ce838..a35089b5294 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockReplacement.java @@ -80,7 +80,6 @@ public class TestBlockReplacement { long bytesToSend = TOTAL_BYTES; long start = Time.monotonicNow(); DataTransferThrottler throttler = new DataTransferThrottler(bandwidthPerSec); - long totalBytes = 0L; long bytesSent = 1024*512L; // 0.5MB throttler.throttle(bytesSent); bytesToSend -= bytesSent; @@ -92,7 +91,7 @@ public class TestBlockReplacement { } catch (InterruptedException ignored) {} throttler.throttle(bytesToSend); long end = Time.monotonicNow(); - assertTrue(totalBytes*1000/(end-start)<=bandwidthPerSec); + assertTrue(TOTAL_BYTES * 1000 / (end - start) <= bandwidthPerSec); } @Test