Skip to content

Commit 90820d8

Browse files
committed
test: cover Jetty logging backend
1 parent edac461 commit 90820d8

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

test/agiladmin/logging_test.clj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
(ns agiladmin.logging-test
2+
(:require [midje.sweet :refer :all])
3+
(:import [org.eclipse.jetty.util.log Log]
4+
[org.slf4j LoggerFactory]))
5+
6+
(fact "Jetty logging does not depend on the Clojure SLF4J adapter"
7+
(Class/forName "com.github.fzakaria.slf4j.timbre.TimbreLoggerAdapter")
8+
=> (throws ClassNotFoundException)
9+
10+
(.getName (class (LoggerFactory/getLogger "agiladmin.logging-test")))
11+
=> "org.slf4j.impl.SimpleLogger"
12+
13+
(let [result (promise)
14+
worker (Thread.
15+
(fn []
16+
(try
17+
(.warn (Log/getLogger "agiladmin.logging-test")
18+
"Worker failure"
19+
(RuntimeException. "expected test exception"))
20+
(deliver result :logged)
21+
(catch Throwable error
22+
(deliver result error)))))]
23+
(.start worker)
24+
(.join worker)
25+
@result)
26+
=> :logged)

test/agiladmin/test_runner.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
agiladmin.dev-auth-test
88
agiladmin.graphics-test
99
agiladmin.handlers-test
10+
agiladmin.logging-test
1011
agiladmin.pocketbase-integration-test
1112
agiladmin.pocketbase-test
1213
agiladmin.ring-test

0 commit comments

Comments
 (0)