Skip to content

Commit

Permalink
add MDC concatenate test (#253)
Browse files Browse the repository at this point in the history
Co-authored-by: Denys Fakhritdinov <dfakhritdinov@evolution.com>
  • Loading branch information
dfakhritdinov and Denys Fakhritdinov authored Dec 1, 2023
1 parent e68162e commit 7ee706e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions core/src/test/scala/com/evolutiongaming/catshelper/LogSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ class LogSpec extends AnyFunSuite with Matchers {
))
}

test("preset MDC concatenates with in-place MDC") {

val stateT = for {
log0 <- logOf("source")
log = log0.withMdc(Log.Mdc.Eager("preset" -> "value"))
_ <- log.info("info", Log.Mdc.Eager("info" -> "value"))
} yield {}

val (state, _) = stateT.run(State(Nil))
state shouldEqual State(List(
Action.Info("info", Log.Mdc.Eager("info" -> "value", "preset" -> "value")),
Action.OfStr("source")
))
}

test("MDC cleanup") {

val io = for {
Expand Down

0 comments on commit 7ee706e

Please sign in to comment.