Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Roiocam committed Aug 19, 2024
1 parent 0ac6a41 commit e1750d8
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ class StubbedSupervisionSpec extends AnyWordSpec with Matchers with LogCapturing
supervise(targetBehavior(inboxRef))
.onFailure[Exc2](SupervisorStrategy.resume)
.onFailure[Exc3](SupervisorStrategy.restart)
.onFailure[Exc1](SupervisorStrategy.stop)
}

"not catch fatal error" in {
Expand Down Expand Up @@ -283,28 +282,24 @@ class StubbedSupervisionSpec extends AnyWordSpec with Matchers with LogCapturing
}
}

class SupervisionSpec extends ScalaTestWithActorTestKit(
"""
class SupervisionSpec extends ScalaTestWithActorTestKit("""
pekko.log-dead-letters = off
""") with AnyWordSpecLike with LogCapturing {

import BehaviorInterceptor._
import SupervisionSpec._

private val nameCounter = Iterator.from(0)

private def nextName(prefix: String = "a"): String = s"$prefix-${nameCounter.next()}"

class FailingConstructorTestSetup(failCount: Int) {
val failCounter = new AtomicInteger(0)

class FailingConstructor(context: ActorContext[Command], monitor: ActorRef[Event])
extends AbstractBehavior[Command](context) {
monitor ! Started
if (failCounter.getAndIncrement() < failCount) {
throw TestException("simulated exc from constructor")
}

override def onMessage(message: Command): Behavior[Command] = {
monitor ! Pong(0)
Behaviors.same
Expand Down Expand Up @@ -358,7 +353,6 @@ class SupervisionSpec extends ScalaTestWithActorTestKit(
class FailingDeferredTestSetup(failCount: Int, strategy: SupervisorStrategy) {
val probe = TestProbe[AnyRef]("evt")
val failCounter = new AtomicInteger(0)

def behv =
supervise(setup[Command] { _ =>
val count = failCounter.getAndIncrement()
Expand All @@ -374,7 +368,6 @@ class SupervisionSpec extends ScalaTestWithActorTestKit(

class FailingUnhandledTestSetup(strategy: SupervisorStrategy) {
val probe = TestProbe[AnyRef]("evt")

def behv =
supervise(setup[Command] { _ =>
probe.ref ! StartFailed
Expand Down

0 comments on commit e1750d8

Please sign in to comment.