Skip to content

What is the correct way to test an Actor? #210

Answered by slawlor
nsengupta asked this question in Q&A
Discussion options

You must be logged in to vote

You shouldnt be sending an actor handle as the reply, this is what RpcReplyPort is specifically for. It's a channel to receive the reply of a defined message type. It's what all the call macros are expecting as the last argument of the tuple including ActorRef.call.

If you look at the source code for the crate, the tests for the rpc module should show you how the usage is expected to be defined.

Additionally your test comparison would be a bit easier to reason about with assert!(matches!(ExpectedPattern, result))

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nsengupta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants