Skip to content

Commit 6586156

Browse files
author
Nathan Marz
committed
added test of multiple tasks per executor
1 parent 57a78cb commit 6586156

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/clj/backtype/storm/integration_test.clj

+24
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,30 @@
3434
(read-tuples results "4")))
3535
))))
3636

37+
(defbolt emit-task-id ["tid"] {:prepare true}
38+
[conf context collector]
39+
(let [tid (.getThisTaskIndex context)]
40+
(bolt
41+
(execute [tuple]
42+
(emit-bolt! collector [tid] :anchor tuple)
43+
(ack! collector tuple)
44+
))))
45+
46+
(deftest test-multi-tasks-per-executor
47+
(with-simulated-time-local-cluster [cluster :supervisors 4]
48+
(let [topology (thrift/mk-topology
49+
{"1" (thrift/mk-spout-spec (TestWordSpout. true))}
50+
{"2" (thrift/mk-bolt-spec {"1" :shuffle} emit-task-id
51+
:parallelism-hint 3
52+
:conf {TOPOLOGY-TASKS 6})
53+
})
54+
results (complete-topology cluster
55+
topology
56+
:mock-sources {"1" [["a"] ["a"] ["a"] ["a"] ["a"] ["a"]]})]
57+
(is (ms= [[0] [1] [2] [3] [4] [5]]
58+
(read-tuples results "2")))
59+
)))
60+
3761
(defbolt ack-every-other {} {:prepare true}
3862
[conf context collector]
3963
(let [state (atom -1)]

0 commit comments

Comments
 (0)