|
48 | 48 | set
|
49 | 49 | )))
|
50 | 50 |
|
| 51 | +(defn topology-slots [state storm-name] |
| 52 | + (let [storm-id (get-storm-id state storm-name) |
| 53 | + assignment (.assignment-info state storm-id nil)] |
| 54 | + (->> assignment |
| 55 | + :executor->node+port |
| 56 | + vals |
| 57 | + set |
| 58 | + ))) |
| 59 | + |
51 | 60 | (defn topology-node-distribution [state storm-name]
|
52 | 61 | (let [storm-id (get-storm-id state storm-name)
|
53 | 62 | assignment (.assignment-info state storm-id nil)]
|
|
189 | 198 | ))))
|
190 | 199 |
|
191 | 200 | (deftest test-isolated-assignment
|
192 |
| - (with-local-cluster [cluster :supervisors 6 |
| 201 | + (with-simulated-time-local-cluster [cluster :supervisors 6 |
193 | 202 | :ports-per-supervisor 3
|
194 | 203 | :inimbus (isolation-nimbus)
|
195 | 204 | :daemon-conf {SUPERVISOR-ENABLE false
|
196 | 205 | TOPOLOGY-ACKER-EXECUTORS 0
|
197 | 206 | STORM-SCHEDULER "backtype.storm.scheduler.IsolationScheduler"
|
198 | 207 | ISOLATION-SCHEDULER-MACHINES {"tester1" 3 "tester2" 2}
|
| 208 | + NIMBUS-MONITOR-FREQ-SECS 10 |
199 | 209 | }]
|
200 | 210 | (letlocals
|
201 | 211 | (bind state (:storm-cluster-state cluster))
|
|
206 | 216 | "3" (thrift/mk-bolt-spec {"2" :none} (TestPlannerBolt.))}))
|
207 | 217 |
|
208 | 218 | (submit-local-topology nimbus "noniso" {TOPOLOGY-OPTIMIZE false TOPOLOGY-WORKERS 4} topology)
|
| 219 | + (advance-cluster-time cluster 1) |
209 | 220 | (is (= 4 (topology-num-nodes state "noniso")))
|
210 | 221 | (is (= 4 (storm-num-workers state "noniso")))
|
211 | 222 |
|
212 | 223 | (submit-local-topology nimbus "tester1" {TOPOLOGY-OPTIMIZE false TOPOLOGY-WORKERS 6} topology)
|
213 | 224 | (submit-local-topology nimbus "tester2" {TOPOLOGY-OPTIMIZE false TOPOLOGY-WORKERS 6} topology)
|
| 225 | + (advance-cluster-time cluster 1) |
214 | 226 |
|
215 | 227 | (bind task-info-tester1 (storm-component->task-info cluster "tester1"))
|
216 | 228 | (bind task-info-tester2 (storm-component->task-info cluster "tester2"))
|
|
227 | 239 | (check-consistency cluster "tester1")
|
228 | 240 | (check-consistency cluster "tester2")
|
229 | 241 | (check-consistency cluster "noniso")
|
| 242 | + |
| 243 | + ;;check that nothing gets reassigned |
| 244 | + (bind tester1-slots (topology-slots state "tester1")) |
| 245 | + (bind tester2-slots (topology-slots state "tester2")) |
| 246 | + (bind noniso-slots (topology-slots state "noniso")) |
| 247 | + (advance-cluster-time cluster 20) |
| 248 | + (is (= tester1-slots (topology-slots state "tester1"))) |
| 249 | + (is (= tester2-slots (topology-slots state "tester2"))) |
| 250 | + (is (= noniso-slots (topology-slots state "noniso"))) |
| 251 | + |
230 | 252 | )))
|
231 | 253 |
|
232 | 254 | (deftest test-zero-executor-or-tasks
|
|
0 commit comments