-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Labels
1 - triagedTickets that are safe to pick up for contributing in terms of likeliness of being acceptedTickets that are safe to pick up for contributing in terms of likeliness of being acceptedhelp wantedIssues that the core team will likely not have time to work onIssues that the core team will likely not have time to work ont:testingt:typed
Description
I tried the example test case introduced in https://doc.akka.io/docs/akka/current/typed/testing-async.html#controlling-the-scheduler,
even if I change the first call to manualTime.expectNoMessageFor
from manualTime.expectNoMessageFor(9.millis, probe) to manualTime.expectNoMessageFor(11.millis, probe) or longer period,
It still passes.
import scala.concurrent.duration._
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
import akka.actor.testkit.typed.scaladsl.ManualTime
import akka.actor.testkit.typed.scaladsl.TestProbe
import akka.actor.testkit.typed.scaladsl.LogCapturing
import akka.actor.typed.scaladsl.Behaviors
import org.scalatest.wordspec.AnyWordSpecLike
class ManualTimerExampleSpec
extends ScalaTestWithActorTestKit(ManualTime.config)
with AnyWordSpecLike
with LogCapturing {
val manualTime: ManualTime = ManualTime()
"A timer" must {
"schedule non-repeated ticks" in {
case object Tick
case object Tock
val probe = TestProbe[Tock.type]()
val behavior = Behaviors.withTimers[Tick.type] { timer =>
timer.startSingleTimer(Tick, 10.millis)
Behaviors.receiveMessage { _ =>
probe.ref ! Tock
Behaviors.same
}
}
spawn(behavior)
manualTime.expectNoMessageFor(9.millis, probe)
manualTime.timePasses(2.millis)
probe.expectMessage(Tock)
manualTime.expectNoMessageFor(10.seconds, probe)
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
1 - triagedTickets that are safe to pick up for contributing in terms of likeliness of being acceptedTickets that are safe to pick up for contributing in terms of likeliness of being acceptedhelp wantedIssues that the core team will likely not have time to work onIssues that the core team will likely not have time to work ont:testingt:typed