Commit 46684492 authored by Ihrig, Arvid Conrad (ari)'s avatar Ihrig, Arvid Conrad (ari)
Browse files

Integrated Pipeline: added unit-tests for logging ResultWriterEvents

parent 4dcd72ed
...@@ -81,7 +81,7 @@ trait EventLogger extends EventListener with Logging { ...@@ -81,7 +81,7 @@ trait EventLogger extends EventListener with Logging {
message match { message match {
case x: ResultWriterEventStart => logger.info( case x: ResultWriterEventStart => logger.info(
baseMarker, baseMarker,
s"[ResultWriter ${reporter.name}] started processing results for file tree " + s"[ResultWriter ${reporter.name}] started writing results for file tree " +
s"'${x.treeTask.treeBasePath}'" s"'${x.treeTask.treeBasePath}'"
) )
case x: ResultWriterEventResult => logger.debug( case x: ResultWriterEventResult => logger.debug(
......
...@@ -140,6 +140,34 @@ class EventLoggerSpec extends LoggingTestWrapper with MockitoSugar with EventLis ...@@ -140,6 +140,34 @@ class EventLoggerSpec extends LoggingTestWrapper with MockitoSugar with EventLis
behave like eventListener(createFixture) behave like eventListener(createFixture)
behave like eventListenerWithRegisteredResultWriter(createFixture) behave like eventListenerWithRegisteredResultWriter(createFixture)
"log result writing start events as info messages" in { log =>
val f = createFixture()
val message = aResultWriterEventStart().withBasePath("/foo/bar")
f.logger.processEvent(f.resultWriterId.get, message)
exactly(1, log.messages()) should (startWith("INFO") and
includeAll("/foo/bar", "start", "writing results"))
}
"log result writing events as debug messages" in { log =>
val f = createFixture()
val message = aResultWriterEventResult().withBasePath("/foo/bar").
withRelativePath("magic/file.out")
f.logger.processEvent(f.resultWriterId.get, message)
exactly(1, log.messages()) should (startWith("DEBUG") and
includeAll("/foo/bar", "magic/file.out", "processes"))
}
"log result writing end events as info messages" in { log =>
val f = createFixture()
val message = aResultWriterEventEnd().withBasePath("/foo/bar").withNumCalculations(42).
withNumParsingFailures(13).withOutputPath("/imaginary/output")
f.logger.processEvent(f.resultWriterId.get, message)
exactly(1, log.messages()) should (startWith("INFO") and
includeAll("/foo/bar", "finished writing", "/imaginary/output", "42 calculations",
"13 parsing failures"))
}
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment