Last active
August 29, 2015 14:25
-
-
Save pharaujo/b94ecde0d1831335b7be to your computer and use it in GitHub Desktop.
riemann: simple config with test
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
; -*- mode: clojure; -*- | |
; vim: filetype=clojure | |
(logging/init {:file "riemann.log" :console false}) | |
; Listen on the local interface over TCP (5555) and UDP (5555) | |
; needs `io` to prevent side-effects in testing | |
(io | |
(let [host "127.0.0.1"] | |
(tcp-server {:host host}) | |
(udp-server {:host host}))) | |
; Expire old events from the index every 5 seconds. | |
(periodically-expire 5) | |
(let [index (default :ttl 30 (tap :test-index (index)))] | |
(streams | |
(where (service "service-to-index") index))) | |
(tests | |
(deftest index-test | |
(let [events [ {:service "service-to-index" :host "host1" :metric 1} | |
{:service "service-to-something" :host "host2" :metric 2} ] | |
expect [ {:service "service-to-index" :host "host1" :metric 1 :ttl 30} ] | |
index (:test-index (inject! events))] | |
(is (= index expect)) | |
(riemann.test/test-stream (match :service "service-to-index") index expect)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment