Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/stable'
Browse files Browse the repository at this point in the history
* upstream/stable:
  (PDB-3240) Switched test logging predicates to use Event objects
  • Loading branch information
Ryan Senior committed Jan 13, 2017
2 parents f1d7548 + 14e0eea commit 3fc30ec
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/puppetlabs/puppetdb/testutils/log.clj
Expand Up @@ -10,7 +10,8 @@
[ch.qos.logback.core.spi LifeCycle]
[ch.qos.logback.classic Level Logger]
[ch.qos.logback.classic.encoder PatternLayoutEncoder]
[org.slf4j LoggerFactory]))
[org.slf4j LoggerFactory]
[ch.qos.logback.classic.spi ILoggingEvent]))

(defmacro with-started
"Ensures that if a given name's init form executes without throwing
Expand Down Expand Up @@ -196,10 +197,15 @@
;;The below functions are useful with
;;puppetlabs.trapperkeeper.testutils.logging/with-log-suppressed-unless-notable

(def critical-errors (comp #{:fatal :error} :level))
(defn critical-errors
[^ILoggingEvent event]
(= Level/ERROR
(.getLevel event)))

(defn starting-with
"Filters log events that have a message starting with `string`"
[string]
(fn [event]
(.startsWith (:message event) string)))
(fn [^ILoggingEvent event]
(-> event
.getMessage
(.startsWith string))))

0 comments on commit 3fc30ec

Please sign in to comment.