hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkarana...@apache.org
Subject [26/50] [abbrv] hadoop git commit: YARN-7084. TestSchedulingMonitor#testRMStarts fails sporadically. Contributed by Jason Lowe.
Date Tue, 03 Oct 2017 21:23:43 GMT
YARN-7084. TestSchedulingMonitor#testRMStarts fails sporadically. Contributed by Jason Lowe.


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

Branch: refs/heads/YARN-6592
Commit: 7f6118f918e0fbe81cb64e8b9f6959b8d66679f6
Parents: d3b1c63
Author: Eric Payne <epayne@apache.org>
Authored: Fri Sep 29 10:33:57 2017 -0500
Committer: Eric Payne <epayne@apache.org>
Committed: Fri Sep 29 10:33:57 2017 -0500

----------------------------------------------------------------------
 .../monitor/TestSchedulingMonitor.java          | 34 +++++++-------------
 1 file changed, 11 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/7f6118f9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/TestSchedulingMonitor.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/monitor/TestSchedulingMonitor.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/TestSchedulingMonitor.java
index d6ac346..c38236d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/TestSchedulingMonitor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/TestSchedulingMonitor.java
@@ -25,42 +25,30 @@ import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.ProportionalCapacityPreemptionPolicy;
 import org.junit.Test;
 
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class TestSchedulingMonitor {
 
   @Test(timeout = 10000)
-  public void testRMStarts() {
+  public void testRMStarts() throws Exception {
     Configuration conf = new YarnConfiguration();
     conf.setBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, true);
     conf.set(YarnConfiguration.RM_SCHEDULER_MONITOR_POLICIES,
         ProportionalCapacityPreemptionPolicy.class.getCanonicalName());
 
     ResourceManager rm = new MockRM();
-    try {
-      rm.init(conf);
-    } catch (Exception e) {
-      fail("ResourceManager does not start when " +
-          YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS + " is set to true");
-    }
-
+    rm.init(conf);
     SchedulingEditPolicy mPolicy = mock(SchedulingEditPolicy.class);
     when(mPolicy.getMonitoringInterval()).thenReturn(1000L);
     SchedulingMonitor monitor = new SchedulingMonitor(rm.getRMContext(),
         mPolicy);
-    try {
-      monitor.serviceInit(conf);
-      monitor.serviceStart();
-    } catch (Exception e) {
-      fail("SchedulingMonitor failes to start.");
-    }
-    verify(mPolicy, times(1)).editSchedule();
-    try {
-      monitor.close();
-      rm.close();
-    } catch (Exception e) {
-      fail("Failed to close.");
-    }
+    monitor.serviceInit(conf);
+    monitor.serviceStart();
+    verify(mPolicy, timeout(10000)).editSchedule();
+    monitor.close();
+    rm.close();
   }
 }


---------------------------------------------------------------------
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