You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by vi...@apache.org on 2017/10/03 18:06:18 UTC
[28/50] [abbrv] hadoop git commit: HADOOP-14752.
TestCopyFromLocal#testCopyFromLocalWithThreads is fleaky. Contributed by
Andras Bokor.
HADOOP-14752. TestCopyFromLocal#testCopyFromLocalWithThreads is fleaky. Contributed by Andras Bokor.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/442ea855
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/442ea855
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/442ea855
Branch: refs/heads/HDFS-9806
Commit: 442ea85545ce3591f45211773a10346340abaed5
Parents: ceca969
Author: Anu Engineer <ae...@apache.org>
Authored: Mon Oct 2 13:11:47 2017 -0700
Committer: Anu Engineer <ae...@apache.org>
Committed: Mon Oct 2 13:11:47 2017 -0700
----------------------------------------------------------------------
.../apache/hadoop/fs/shell/TestCopyFromLocal.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/442ea855/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyFromLocal.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyFromLocal.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyFromLocal.java
index 8d354b4..8e60540 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyFromLocal.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestCopyFromLocal.java
@@ -115,10 +115,10 @@ public class TestCopyFromLocal {
Path dir = new Path("dir" + RandomStringUtils.randomNumeric(4));
int numFiles = TestCopyFromLocal.initialize(dir);
int maxThreads = Runtime.getRuntime().availableProcessors() * 2;
- int randThreads = RandomUtils.nextInt(maxThreads);
- int numActualThreads = randThreads == 0 ? 1 : randThreads;
- String numThreads = Integer.toString(numActualThreads);
- run(new TestMultiThreadedCopy(numActualThreads, numFiles), "-t", numThreads,
+ int randThreads = RandomUtils.nextInt(maxThreads - 1) + 1;
+ String numThreads = Integer.toString(randThreads);
+ run(new TestMultiThreadedCopy(randThreads,
+ randThreads == 1 ? 0 : numFiles), "-t", numThreads,
new Path(dir, FROM_DIR_NAME).toString(),
new Path(dir, TO_DIR_NAME).toString());
}
@@ -144,6 +144,7 @@ public class TestCopyFromLocal {
}
private class TestMultiThreadedCopy extends CopyFromLocal {
+ public static final String NAME = "testCopyFromLocal";
private int expectedThreads;
private int expectedCompletedTaskCount;
@@ -164,9 +165,9 @@ public class TestCopyFromLocal {
// 2) There are no active tasks in the executor
// 3) Executor has shutdown correctly
ThreadPoolExecutor executor = getExecutor();
- Assert.assertEquals(executor.getCompletedTaskCount(),
- expectedCompletedTaskCount);
- Assert.assertEquals(executor.getActiveCount(), 0);
+ Assert.assertEquals(expectedCompletedTaskCount,
+ executor.getCompletedTaskCount());
+ Assert.assertEquals(0, executor.getActiveCount());
Assert.assertTrue(executor.isTerminated());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org