Github user srdo commented on a diff in the pull request:
https://github.com/apache/storm/pull/2507#discussion_r160271224
--- Diff:
storm-server/src/test/java/org/apache/storm/nimbus/LocalNimbusTest.java ---
@@ -32,42 +37,35 @@
import org.junit.Assert;
import org.junit.Test;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.UUID;
-
/**
* Tests local cluster with nimbus and a plugin for {@link
Config#STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN}.
*/
public class LocalNimbusTest {
@Test
public void testSubmitTopologyToLocalNimbus() throws Exception {
-
- HashMap<String,Object> localClusterConf = new HashMap<>();
- localClusterConf.put("nimbus-daemon", true);
- ILocalCluster localCluster =
Testing.getLocalCluster(localClusterConf);
-
- Config topoConf = new Config();
- topoConf.putAll(Utils.readDefaultConfig());
- topoConf.setDebug(true);
- topoConf.put("storm.cluster.mode", "local"); // default is aways
"distributed" but here local cluster is being used.
- topoConf.put(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN,
InmemoryTopologySubmitterHook.class.getName());
-
- List<TopologyDetails> topologyNames =new ArrayList<>();
- for (int i=0; i<4; i++) {
- final String topologyName = "word-count-"+
UUID.randomUUID().toString();
- final StormTopology stormTopology = createTestTopology();
- topologyNames.add(new TopologyDetails(topologyName,
stormTopology));
- localCluster.submitTopology(topologyName, topoConf,
stormTopology);
+ int port = Utils.getAvailablePort();
--- End diff --
I'd like us to at least file a JIRA to look into changing it, even if we
don't do it now. Most of the other uses of Utils.getAvailablePort should have
been removed in earlier PRs (e.g. https://github.com/apache/storm/pull/2140). I
want to say assigning ports this way was causing test failures on Travis, but
it's been a while so I may be misremembering.
---