Created
April 17, 2013 13:29
-
-
Save ulises/5404292 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn mock-sink [] | |
(let [call-count (atom 0) | |
call-args (atom "no args yet")] | |
(with-meta (fn [_] | |
(fn [event] | |
(swap! call-count inc) | |
(reset! call-args event))) | |
{:call-count call-count | |
:call-args call-args}))) | |
(defn call-count [mock] | |
@(:call-count (meta mock))) | |
(fact "a hammered sink should not throw" | |
(with-redefs [riemann.graphite/graphite (mock-sink)] | |
(let [sink (init-internal {:host "fake"}) | |
events 120000 | |
_ (last (map deref (map (fn [_] (future (sink ..event..))) (range events))))] | |
(call-count riemann.graphite/graphite) => events))) | |
;; fails with | |
FAIL "about the performance of graphite sinks - a hammered sink should not throw" at (graphite_test.clj:65) | |
Expected: 120000 | |
Actual: 119997 | |
FAILURE: 1 check failed. (But 31 succeeded.) | |
Subprocess failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment