Skip to content

Instantly share code, notes, and snippets.

@dbriones
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbriones/91642eadd4e3d16723d7 to your computer and use it in GitHub Desktop.
Save dbriones/91642eadd4e3d16723d7 to your computer and use it in GitHub Desktop.
throttle unaffected by riemann.time.controlled/advance!
(streams
(throttle 1 10
(tap :throttle
#(info %))))
(tests
(let [input {:service "some-service"}]
(deftest throttle-should-allow-events-after-window-passes
(is (= (inject! [input])
{:throttle [input]}))
(is (= (inject! [input])
{:throttle []}))
(riemann.time.controlled/advance! 11)
(is (= (inject! [input])
{:throttle [input]})))))
@dbriones
Copy link
Author

dbriones commented Aug 6, 2014

17:23:55 powerhaus riemann-0.2.6 $ bin/riemann test etc/throttle-not-affected-by-time.clj 
loading bin

Testing riemann.config-test
INFO [2014-08-05 17:41:07,694] main - riemann.config - {:service some-service}

FAIL in (throttle-should-allow-events-after-window-passes) (throttle-not-affected-by-time.clj:16)
expected: (= (inject! [input]) {:throttle [input]})
  actual: (not (= {:throttle []} {:throttle [{:service "some-service"}]}))

Ran 1 tests containing 3 assertions.
1 failures, 0 errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment