Skip to content

Commit

Permalink
Merge pull request TheClimateCorporation#18 from jeddenlea/master
Browse files Browse the repository at this point in the history
Misc fixes.
  • Loading branch information
mlimotte committed Mar 21, 2013
2 parents 99083bf + 147c4d0 commit d537c99
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
7 changes: 4 additions & 3 deletions src/main/clj/com/climate/services/aws/ec2.clj
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@
([hours]
(spot-price-history hours nil))
([hours type]
(let [now (GregorianCalendar.)
end (.getTime now)
start (.getTime (.add now GregorianCalendar/HOUR_OF_DAY hours))
(let [[start end] (let [volatile-cal (GregorianCalendar.)
end (.getTime volatile-cal)]
(.add volatile-cal GregorianCalendar/HOUR_OF_DAY (- hours))
[(.getTime volatile-cal) end])
sort-by (partial sort-by #(.getTimestamp %))
req (doto (DescribeSpotPriceHistoryRequest.)
(.setStartTime start)
Expand Down
6 changes: 4 additions & 2 deletions src/main/clj/lemur/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,8 @@ calls launch - take action (upload files, start cluster, etc)
(cl-format true "~{~12<~a~>~}~%~
~{~{~12<~a~>~}~%~}"
(take-nth 2 flds)
details))
details)
(flush))
(quit))

(defn- spot-price-history
Expand All @@ -918,7 +919,8 @@ calls launch - take action (upload files, start cluster, etc)
(cl-format true "~{~12<~a~>~}~%~
~{~{~12<~a~>~}~%~}"
(take-nth 2 flds)
details))
details)
(flush))
(quit))

(defmacro when-local-test
Expand Down
17 changes: 9 additions & 8 deletions src/test/clj/com/climate/shell_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@
:env (merge-env {:FOO "bar"}))))))

(deftest test-merge-env-2
(is (re-find
#"\[\"[\.\/\w]+\" \"bar\"\]"
(:out (sh "java" "-cp" (clj-main-jar) "clojure.main" "-e"
"(vector
(get (System/getenv) \"JAVA_HOME\")
(get (System/getenv) \"FOO\"))"
:err :pass
:env (merge-env {:FOO "bar"}))))))
(is (when-let [java-home (get (System/getenv) "JAVA_HOME")]
(.startsWith
(:out (sh "java" "-cp" (clj-main-jar) "clojure.main" "-e"
"(vector
(get (System/getenv) \"JAVA_HOME\")
(get (System/getenv) \"FOO\"))"
:err :pass
:env (merge-env {:FOO "bar"})))
(pr-str (vector java-home "bar"))))))

(deftest test-sh-with-files
(let [txt "some test text"
Expand Down

0 comments on commit d537c99

Please sign in to comment.