Github user d2r commented on a diff in the pull request:
https://github.com/apache/incubator-storm/pull/36#discussion_r16066139
--- Diff: storm-core/test/clj/backtype/storm/scheduler_test.clj ---
@@ -259,3 +260,27 @@
(is (= false (.isSlotOccupied cluster (WorkerSlot. "supervisor1" (int
3)))))
(is (= false (.isSlotOccupied cluster (WorkerSlot. "supervisor1" (int
5)))))
))
+
+(deftest test-sort-slots
+ ;; test supervisor2 has more free slots
+ (is (= '(["supervisor2" 6700] ["supervisor1" 6700]
+ ["supervisor2" 6701] ["supervisor1" 6701]
+ ["supervisor2" 6702])
+ (sort-slots [["supervisor1" 6700] ["supervisor1" 6701]
+ ["supervisor2" 6700] ["supervisor2" 6701]
["supervisor2" 6702]
+ ])))
+ ;; test supervisor3 has more free slots
+ (is (= '(["supervisor3" 6700] ["supervisor2" 6700] ["supervisor1" 6700]
+ ["supervisor3" 6701] ["supervisor2" 6701] ["supervisor1" 6701]
+ ["supervisor3" 6702] ["supervisor2" 6702]
+ ["supervisor3" 6703])
+ (sort-slots [["supervisor1" 6700] ["supervisor1" 6701]
+ ["supervisor2" 6700] ["supervisor2" 6701]
["supervisor2" 6702]
+ ["supervisor3" 6700] ["supervisor3" 6701]
["supervisor3" 6702] ["supervisor3" 6703]
+ ])))
+ ;; test supervisor1 and supervisor2 has the same free slot
+ (is (= '(["supervisor1" 6700] ["supervisor2" 6700]
+ ["supervisor1" 6701] ["supervisor2" 6701])
+ (sort-slots [["supervisor1" 6700] ["supervisor1" 6701]
["supervisor2" 6700] ["supervisor2" 6701]])))
+ )
--- End diff --
This test passes with or without your change. Do we need this test?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---