Github user xiaokang commented on a diff in the pull request:

    https://github.com/apache/incubator-storm/pull/36#discussion_r16300197
  
    --- 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 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]])))
    +  ;; 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]
    +                      ])))
    +    )
    --- End diff --
    
    The port numbers will be in the same order as they are given in the 
arguments, since 'group-by' and 'vals' function both keep order of input 
collection or sequence. I also changed the port numbers order in the tests to 
make sure about this.


---
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.
---

Reply via email to