Add log capturing for typed stream tests (to pin down pubsub stream failures) (#31118)
This commit is contained in:
parent
3c83f9cf64
commit
8c64400b40
4 changed files with 36 additions and 5 deletions
31
akka-stream-typed/src/test/resources/logback-test.xml
Normal file
31
akka-stream-typed/src/test/resources/logback-test.xml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<!-- Silence initial setup logging from Logback -->
|
||||||
|
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
|
||||||
|
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%date{ISO8601} %-5level %logger %marker - %msg MDC: {%mdc}%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Logging from tests are silenced by this appender. When there is a test failure
|
||||||
|
the captured logging events are flushed to the appenders defined for the
|
||||||
|
akka.actor.testkit.typed.internal.CapturingAppenderDelegate logger.
|
||||||
|
-->
|
||||||
|
<appender name="CapturingAppender" class="akka.actor.testkit.typed.internal.CapturingAppender" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The appenders defined for this CapturingAppenderDelegate logger are used
|
||||||
|
when there is a test failure and all logging events from the test are
|
||||||
|
flushed to these appenders.
|
||||||
|
-->
|
||||||
|
<logger name="akka.actor.testkit.typed.internal.CapturingAppenderDelegate" >
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<root level="TRACE">
|
||||||
|
<appender-ref ref="CapturingAppender"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
|
|
@ -23,7 +23,7 @@ object ActorSourceSinkSpec {
|
||||||
case object Failed extends AckProto
|
case object Failed extends AckProto
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActorSourceSinkSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike {
|
class ActorSourceSinkSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with LogCapturing {
|
||||||
import ActorSourceSinkSpec._
|
import ActorSourceSinkSpec._
|
||||||
|
|
||||||
"ActorSink" should {
|
"ActorSink" should {
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@ package akka.stream.typed.scaladsl
|
||||||
|
|
||||||
import scala.concurrent.Future
|
import scala.concurrent.Future
|
||||||
import scala.util.Success
|
import scala.util.Success
|
||||||
|
|
||||||
import org.scalatest.wordspec.AnyWordSpecLike
|
import org.scalatest.wordspec.AnyWordSpecLike
|
||||||
|
|
||||||
import akka.Done
|
import akka.Done
|
||||||
|
import akka.actor.testkit.typed.scaladsl.LogCapturing
|
||||||
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
|
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
|
||||||
import akka.actor.typed.scaladsl.Behaviors
|
import akka.actor.typed.scaladsl.Behaviors
|
||||||
import akka.stream.AbruptStageTerminationException
|
import akka.stream.AbruptStageTerminationException
|
||||||
|
|
@ -17,7 +16,7 @@ import akka.stream.Materializer
|
||||||
import akka.stream.scaladsl.Sink
|
import akka.stream.scaladsl.Sink
|
||||||
import akka.stream.scaladsl.Source
|
import akka.stream.scaladsl.Source
|
||||||
|
|
||||||
class MaterializerForTypedSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike {
|
class MaterializerForTypedSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with LogCapturing {
|
||||||
|
|
||||||
"Materialization in typed" should {
|
"Materialization in typed" should {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
package akka.stream.typed.scaladsl
|
package akka.stream.typed.scaladsl
|
||||||
|
|
||||||
|
import akka.actor.testkit.typed.scaladsl.LogCapturing
|
||||||
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
|
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
|
||||||
import akka.actor.typed.internal.pubsub.TopicImpl
|
import akka.actor.typed.internal.pubsub.TopicImpl
|
||||||
import akka.actor.typed.pubsub.Topic
|
import akka.actor.typed.pubsub.Topic
|
||||||
|
|
@ -12,7 +13,7 @@ import akka.stream.scaladsl.Source
|
||||||
import akka.stream.testkit.scaladsl.TestSink
|
import akka.stream.testkit.scaladsl.TestSink
|
||||||
import org.scalatest.wordspec.AnyWordSpecLike
|
import org.scalatest.wordspec.AnyWordSpecLike
|
||||||
|
|
||||||
class PubSubSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike {
|
class PubSubSpec extends ScalaTestWithActorTestKit with AnyWordSpecLike with LogCapturing {
|
||||||
|
|
||||||
"PubSub.source" should {
|
"PubSub.source" should {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue