New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: additional test case for terminated PromiseActorRef #32129
Conversation
akka-actor-typed-tests/src/test/scala/akka/actor/typed/DeadLetterSpec.scala
Outdated
Show resolved
Hide resolved
a3f0a69
to
9d865c6
Compare
9d865c6
to
8af1cac
Compare
case class WorkerMultiply(a: Int, b: Int, replyTo: ActorRef[WorkerResult]) extends WorkerCommand | ||
case class WorkerResult(num: Int) extends WorkerCommand | ||
|
||
class ManualTerminatedTestSetup(val workerLatch: CountDownLatch) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think either test here requires blocking with a latch? Asking a terminated actor and ask without any reply leading to timeout should be possible without this kind of infrastructure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original purpose of this was to simulate real-life scenarios. However, since you mentioned it, the testing can be greatly simplified by using probes to replace some interactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johanandren PTAL, I have pushed a fixes commit, to ensure the testing remains in minimal implementation. Thnaks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's better, one small suggestion on the actorref lambda parameter naming, then this is good to merge.
akka-actor-typed-tests/src/test/scala/akka/actor/typed/DeadLetterSpec.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: Johan Andrén <johan@markatta.com>
} | ||
|
||
"publish dead letter with recipient when AskPattern timeout" in { | ||
testDeadLetterPublishWhenAskTimeout[WorkerResult](ref => ref.ask(replyTo => WorkerMultiply(3, 9, replyTo))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same name here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After committing, I realized that the actor in question is not a terminated actor.
Instead, I sent a request to an actor and expected a response, the actor is still alive but it's possible that there is a backlog of messages, and only has an issue when message tardy replies.
Therefore, perhaps a tardyRef
would be more appropriate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that, upon reviewing it myself, I realized that there was only one missing test case in the UnitTest I have simplify this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even simpler 👍 LGTM
References #29795
The key of ISSUE #29795 is
PromiseActorRef
. In this PR, I have provided coverage for those problems using additional unit tests:: this already implement oncontext.ask
publish dead-letter if the context.ask has completed on timeout
AskPattern.ask