srdo commented on a change in pull request #3096: STORM-3480 Implement One
Worker Per Executor RAS Option
URL: https://github.com/apache/storm/pull/3096#discussion_r310344407
##########
File path:
storm-server/src/test/java/org/apache/storm/scheduler/resource/strategies/scheduling/TestDefaultResourceAwareStrategy.java
##########
@@ -104,79 +107,214 @@ public void cleanup() {
}
}
- /**
- * test if the scheduling logic for the DefaultResourceAwareStrategy is
correct
+ /*
+ * test assigned memory with shared memory types and oneWorkerPerExecutor
*/
@Test
- public void testDefaultResourceAwareStrategySharedMemory() {
- int spoutParallelism = 2;
- int boltParallelism = 2;
- int numBolts = 3;
+ public void testMultipleSharedMemoryWithOneWorkerPerExecutor() {
+ int spoutParallelism = 4;
double cpuPercent = 10;
double memoryOnHeap = 10;
double memoryOffHeap = 10;
- double sharedOnHeap = 500;
- double sharedOffHeapNode = 700;
- double sharedOffHeapWorker = 500;
- TopologyBuilder builder = new TopologyBuilder();
- builder.setSpout("spout", new TestSpout(),
- spoutParallelism);
- builder.setBolt("bolt-1", new TestBolt(),
- boltParallelism).addSharedMemory(new
SharedOffHeapWithinWorker(sharedOffHeapWorker, "bolt-1 shared off heap
worker")).shuffleGrouping("spout");
- builder.setBolt("bolt-2", new TestBolt(),
- boltParallelism).addSharedMemory(new
SharedOffHeapWithinNode(sharedOffHeapNode, "bolt-2 shared
node")).shuffleGrouping("bolt-1");
- builder.setBolt("bolt-3", new TestBolt(),
- boltParallelism).addSharedMemory(new
SharedOnHeap(sharedOnHeap, "bolt-3 shared worker")).shuffleGrouping("bolt-2");
-
- StormTopology stormToplogy = builder.createTopology();
-
- INimbus iNimbus = new INimbusTest();
- Map<String, SupervisorDetails> supMap = genSupervisors(4, 4, 500,
2000);
- Config conf = createClusterConfig(cpuPercent, memoryOnHeap,
memoryOffHeap, null);
-
- conf.put(Config.TOPOLOGY_PRIORITY, 0);
- conf.put(Config.TOPOLOGY_NAME, "testTopology");
- conf.put(Config.TOPOLOGY_WORKER_MAX_HEAP_SIZE_MB, 2000);
- TopologyDetails topo = new TopologyDetails("testTopology-id", conf,
stormToplogy, 0,
- genExecsAndComps(stormToplogy), CURRENT_TIME, "user");
-
- Topologies topologies = new Topologies(topo);
- Cluster cluster = new Cluster(iNimbus, new ResourceMetrics(new
StormMetricsRegistry()), supMap, new HashMap<>(), topologies, conf);
+ double sharedOnHeap = 450;
+ double sharedOffHeapNode = 600;
+ double sharedOffHeapWorker = 400;
+
+ for (sharedMemoryTypes memoryType : sharedMemoryTypes.values()) {
Review comment:
I think we should use JUnit's support for test parameters here, it will
integrate better with IDEs and reporting tools.
https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services