hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From haiboc...@apache.org
Subject hadoop git commit: YARN-8605. TestDominantResourceFairnessPolicy.testModWhileSorting is flaky. (Wilfred Spiegelenburg via Haibo Chen)
Date Tue, 31 Jul 2018 18:33:43 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 9fea5c9ee -> 8aa93a575


YARN-8605. TestDominantResourceFairnessPolicy.testModWhileSorting is flaky. (Wilfred Spiegelenburg
via Haibo Chen)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8aa93a57
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8aa93a57
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8aa93a57

Branch: refs/heads/trunk
Commit: 8aa93a575e896c609b97ddab58853b1eb95f0dee
Parents: 9fea5c9
Author: Haibo Chen <haibochen@apache.org>
Authored: Tue Jul 31 11:32:40 2018 -0700
Committer: Haibo Chen <haibochen@apache.org>
Committed: Tue Jul 31 11:32:40 2018 -0700

----------------------------------------------------------------------
 .../TestDominantResourceFairnessPolicy.java     | 38 +++++++-------------
 1 file changed, 12 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/8aa93a57/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies/TestDominantResourceFairnessPolicy.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies/TestDominantResourceFairnessPolicy.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies/TestDominantResourceFairnessPolicy.java
index 55b7163..c963e0d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies/TestDominantResourceFairnessPolicy.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies/TestDominantResourceFairnessPolicy.java
@@ -24,7 +24,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
@@ -458,33 +457,20 @@ public class TestDominantResourceFairnessPolicy {
     }
     Comparator DRFComparator = createComparator(100000, 50000);
 
-    // To simulate unallocated resource changes
-    Thread modThread = modificationThread(schedulableList);
-    modThread.start();
+    /*
+     * The old sort should fail, but timing it makes testing to flaky.
+     * TimSort which is used does not handle the concurrent modification of
+     * objects it is sorting. This is the test that should fail:
+     *  modThread.start();
+     *  try {
+     *    Collections.sort(schedulableList, DRFComparator);
+     *  } catch (IllegalArgumentException iae) {
+     *    // failed sort
+     *  }
+     */
 
-    // This should fail: make sure that we do test correctly
-    // TimSort which is used does not handle the concurrent modification of
-    // objects it is sorting.
-    try {
-      Collections.sort(schedulableList, DRFComparator);
-      fail("Sorting should have failed and did not");
-    } catch (IllegalArgumentException iae) {
-      assertEquals(iae.getMessage(), "Comparison method violates its general contract!");
-    }
-    try {
-      modThread.join();
-    } catch (InterruptedException ie) {
-      fail("ModThread join failed: " + ie.getMessage());
-    }
-
-    // clean up and try again using TreeSet which should work
-    schedulableList.clear();
-    for (int i=0; i<10000; i++) {
-      schedulableList.add(
-          (FakeSchedulable)createSchedulable((i%10)*100, (i%3)*2));
-    }
     TreeSet<Schedulable> sortedSchedulable = new TreeSet<>(DRFComparator);
-    modThread = modificationThread(schedulableList);
+    Thread modThread = modificationThread(schedulableList);
     modThread.start();
     sortedSchedulable.addAll(schedulableList);
     try {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message