Add unit test for 3rd-party rotor appender (@rosejn)

This commit is contained in:
Jeff Rose 2015-07-02 15:09:35 -06:00 committed by Peter Taoussanis
parent 31872bc830
commit 09c0a46881
2 changed files with 29 additions and 2 deletions

View File

@ -4,8 +4,6 @@
[taoensso.timbre :as timbre])
(:import [java.io File FilenameFilter]))
;; TODO Test port to Timbre v4
(defn- ^FilenameFilter file-filter
"Returns a Java FilenameFilter instance which only matches
files with the given `basename`."

View File

@ -0,0 +1,29 @@
(ns taoensso.timbre.appenders.3rd-party.rotor-test
(:require
[clojure.test :refer :all]
[clojure.java.io :as io]
[taoensso.timbre :as timbre]
[taoensso.timbre.appenders.3rd-party.rotor :as rotor]))
(deftest rotor-test
[]
(let [logfile "rotor-test.log"
n-logs 5]
(timbre/merge-config!
{:appenders {:rotor (rotor/rotor-appender
{:path logfile
:max-size 200
:backlog n-logs})}})
(doseq [i (range 100)]
(timbre/info "testing..."))
(let [f (io/file logfile)]
(is (.exists f))
(.delete f))
(doseq [i (range 1 (inc n-logs))]
(let [f (io/file (str logfile ".00" i))]
(is (.exists f))
(.delete f)))))