You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by et...@apache.org on 2019/09/05 21:53:59 UTC

[storm] branch master updated: [STORM-3503] add unit test for BLACKLIST_SCHEDULER_ASSUME_SUPERVISOR_… (#3122)

This is an automated email from the ASF dual-hosted git repository.

ethanli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new 93b7d7c  [STORM-3503] add unit test for BLACKLIST_SCHEDULER_ASSUME_SUPERVISOR_… (#3122)
93b7d7c is described below

commit 93b7d7c02b115a598545c6797cd5a9b0f5f791ad
Author: Rui Li <ru...@gmail.com>
AuthorDate: Thu Sep 5 16:53:53 2019 -0500

    [STORM-3503] add unit test for BLACKLIST_SCHEDULER_ASSUME_SUPERVISOR_… (#3122)
---
 .../storm/scheduler/blacklist/TestBlacklistScheduler.java | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/storm-server/src/test/java/org/apache/storm/scheduler/blacklist/TestBlacklistScheduler.java b/storm-server/src/test/java/org/apache/storm/scheduler/blacklist/TestBlacklistScheduler.java
index cd8caf3..8ac0e13 100644
--- a/storm-server/src/test/java/org/apache/storm/scheduler/blacklist/TestBlacklistScheduler.java
+++ b/storm-server/src/test/java/org/apache/storm/scheduler/blacklist/TestBlacklistScheduler.java
@@ -34,6 +34,8 @@ import org.apache.storm.utils.Utils;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -95,8 +97,9 @@ public class TestBlacklistScheduler {
         Assert.assertEquals("blacklist", Collections.singleton("host-0"), cluster.getBlacklistedHosts());
     }
 
-    @Test
-    public void TestBadSlot() {
+    @ParameterizedTest
+    @ValueSource(booleans = {true, false})
+    public void TestBadSlot(boolean blacklistOnBadSlot) {
         INimbus iNimbus = new TestUtilsForBlacklistScheduler.INimbusTest();
 
         Map<String, SupervisorDetails> supMap = TestUtilsForBlacklistScheduler.genSupervisors(3, 4);
@@ -106,6 +109,7 @@ public class TestBlacklistScheduler {
         config.put(DaemonConfig.BLACKLIST_SCHEDULER_TOLERANCE_TIME, 200);
         config.put(DaemonConfig.BLACKLIST_SCHEDULER_TOLERANCE_COUNT, 2);
         config.put(DaemonConfig.BLACKLIST_SCHEDULER_RESUME_TIME, 300);
+        config.put(DaemonConfig.BLACKLIST_SCHEDULER_ASSUME_SUPERVISOR_BAD_BASED_ON_BAD_SLOT, blacklistOnBadSlot);
 
         Map<String, TopologyDetails> topoMap = new HashMap<String, TopologyDetails>();
 
@@ -128,7 +132,12 @@ public class TestBlacklistScheduler {
         scheduler.schedule(topologies, cluster);
         cluster = new Cluster(iNimbus, resourceMetrics, supMap, new HashMap<String, SchedulerAssignmentImpl>(), topologies, config);
         scheduler.schedule(topologies, cluster);
-        Assert.assertEquals("blacklist", Collections.singleton("host-0"), cluster.getBlacklistedHosts());
+
+        if (blacklistOnBadSlot) {
+            Assert.assertEquals("blacklist", Collections.singleton("host-0"), cluster.getBlacklistedHosts());
+        } else {
+            Assert.assertEquals("blacklist", Collections.emptySet(), cluster.getBlacklistedHosts());
+        }
     }
 
     @Test