Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/2507#discussion_r160259977 --- 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 -- Yes it is racy. We have done it this way for other ports without too many issues. The problem is that it would require a feedback path for the port from Nimbus, and possibly a few updates in other places that try to read the port out of the config. If you really want to see this changed I can file a follow on JIRA and look into it, as it would not likely be that much work.
---