Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Commit 4a602fd

Browse files
committed
Test to illustrate #671
1 parent 11adbcb commit 4a602fd

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

summingbird-storm-test/src/test/scala/com/twitter/summingbird/storm/TopologyTests.scala

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,24 @@
1616

1717
package com.twitter.summingbird.storm
1818

19+
import java.util.{Map => JMap}
20+
1921
import backtype.storm.generated.StormTopology
20-
import com.twitter.algebird.{ MapAlgebra, Semigroup }
21-
import com.twitter.storehaus.{ ReadableStore, JMapStore }
22-
import com.twitter.storehaus.algebra.MergeableStore
2322
import com.twitter.summingbird._
24-
import com.twitter.summingbird.online._
23+
import com.twitter.summingbird.batch.Batcher
2524
import com.twitter.summingbird.online.option._
26-
import com.twitter.summingbird.storm.option._
27-
import com.twitter.summingbird.batch.{ BatchID, Batcher }
2825
import com.twitter.summingbird.storm.spout.TraversableSpout
29-
import com.twitter.tormenta.spout.Spout
30-
import com.twitter.util.Future
31-
import java.util.{ Collections, HashMap, Map => JMap, UUID }
32-
import java.util.concurrent.atomic.AtomicInteger
33-
import org.scalatest.WordSpec
3426
import org.scalacheck._
35-
import org.scalacheck.Prop._
36-
import org.scalacheck.Properties
27+
import org.scalatest.WordSpec
3728

3829
import scala.collection.JavaConversions._
39-
import scala.collection.JavaConverters._
40-
import scala.collection.mutable.{
41-
ArrayBuffer,
42-
HashMap => MutableHashMap,
43-
Map => MutableMap,
44-
SynchronizedBuffer,
45-
SynchronizedMap
46-
}
30+
import scala.collection.mutable.{HashMap => MutableHashMap, Map => MutableMap}
31+
4732
/**
4833
* Tests for Summingbird's Storm planner.
4934
*/
5035

5136
class TopologyTests extends WordSpec {
52-
import MapAlgebra.sparseEquiv
5337

5438
// This is dangerous, obviously. The Storm platform graphs tested
5539
// here use the UnitBatcher, so the actual time extraction isn't
@@ -140,6 +124,23 @@ class TopologyTests extends WordSpec {
140124
assert(TDistMap(1).get_common.get_parallelism_hint == 50)
141125
}
142126

127+
"With same setting on multiple names we use the one for the node" in {
128+
val fmNodeName = "flatMapper"
129+
val smNodeName = "summer"
130+
val p = Storm.source(TraversableSpout(sample[List[Int]]))
131+
.flatMap(testFn).name(fmNodeName)
132+
.sumByKey(TestStore.createStore[Int, Int]()._2).name(smNodeName)
133+
134+
val opts = Map(fmNodeName -> Options().set(SummerParallelism(10)),
135+
smNodeName -> Options().set(SummerParallelism(20)))
136+
val storm = Storm.local(opts)
137+
val stormTopo = storm.plan(p).topology
138+
val bolts = stormTopo.get_bolts
139+
140+
// Tail should use parallelism specified for the summer node
141+
assert(bolts("Tail").get_common.get_parallelism_hint == 20)
142+
}
143+
143144
"If the closes doesnt contain the option we keep going" in {
144145
val nodeName = "super dooper node"
145146
val otherNodeName = "super dooper node"

0 commit comments

Comments
 (0)