From common-commits-return-86261-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Tue Jul 31 20:33:45 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C0108180662 for ; Tue, 31 Jul 2018 20:33:44 +0200 (CEST) Received: (qmail 35124 invoked by uid 500); 31 Jul 2018 18:33:43 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 35115 invoked by uid 99); 31 Jul 2018 18:33:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2018 18:33:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 75C55DFA6D; Tue, 31 Jul 2018 18:33:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: haibochen@apache.org To: common-commits@hadoop.apache.org Message-Id: <07c7a483a5b3421cb854606076ad2b43@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: YARN-8605. TestDominantResourceFairnessPolicy.testModWhileSorting is flaky. (Wilfred Spiegelenburg via Haibo Chen) Date: Tue, 31 Jul 2018 18:33:43 +0000 (UTC) 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 Authored: Tue Jul 31 11:32:40 2018 -0700 Committer: Haibo Chen 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 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