Skip to content

Instantly share code, notes, and snippets.

@bracki
Created September 25, 2013 21:29
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 bracki/6706310 to your computer and use it in GitHub Desktop.
Save bracki/6706310 to your computer and use it in GitHub Desktop.
(ns riemann.test.nagios
(:use riemann.nagios
clj-nsca.core
clojure.test)
(:require [riemann.logging :as logging]))
(logging/init)
(def test-event
{:host "host01" :service "test_service" :state "ok" :description "Quick brown fox"})
(def expected
(let [e test-event]
(nagios-message (:host e) (:state e) (:service e) (:description e))))
(deftest test-event-to-nagios
(is (= (event->nagios test-event)
expected)))
(deftest test-stream
(let [calls (atom [])] (with-redefs [clj-nsca.core/send-message (fn [& args] (swap! calls conj args))]
((nagios {}) test-event))
(is (= expected (last (last @calls))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment