Merge pull request #42 from mattiasholmqvist/master

Added in-group? predicate to compute2.clj
This commit is contained in:
Adrian Cole 2011-05-27 09:09:29 -07:00
commit a3a97d02b8
2 changed files with 5 additions and 2 deletions

View File

@ -278,6 +278,11 @@ Here's an example of creating and running a small linux node in the group webser
[#^NodeMetadata node] [#^NodeMetadata node]
(state-predicate node UNRECOGNIZED)) (state-predicate node UNRECOGNIZED))
(defn in-group?
"Returns a predicate fn which returns true if the node is in the given group, false otherwise"
[group]
#(= (.getGroup %) group))
(defn public-ips (defn public-ips
"Returns the node's public ips" "Returns the node's public ips"
[#^NodeMetadata node] [#^NodeMetadata node]

View File

@ -63,8 +63,6 @@ list, Alan Dipert and MeikelBrandmeyer."
(is (compute-service? *compute*)) (is (compute-service? *compute*))
(is (compute-service? (compute-service (compute-context *compute*))))) (is (compute-service? (compute-service (compute-context *compute*)))))
(defn in-group? [group] #(= (.getGroup %) group))
(deftest nodes-test (deftest nodes-test
(is (create-node *compute* "fred" (build-template *compute* {} ))) (is (create-node *compute* "fred" (build-template *compute* {} )))
(is (= 1 (count (nodes-in-group *compute* "fred")))) (is (= 1 (count (nodes-in-group *compute* "fred"))))