Closed christallire closed 3 years ago
The MNTR is the way to go if you need tests that can simulate things like network connectivity problems or gradually forming the network over time. Even though it's clunky, that's the best option we have.
For simple tests where you don't require network dynamism, you can do like what we've done here: https://github.com/akkadotnet/akka.net/blob/dev/src/contrib/cluster/Akka.Cluster.Sharding.Tests/InactiveEntityPassivationSpec.cs
But we won't be publishing an additional testkit for this. The MNTR is it.
Okay, I'm cool with that. Thanks for the answer, that helped.
Hey, I'm new to akka.net and learning akka.net everyday
I'm struggling with ShardRegion for testing. it is hard to write an integration test with a single cluster shard region to validate integration with various actors.
It seems Cluster TestKit is not an option since it requires a lot of setups to work properly (also https://github.com/akkadotnet/akka.net/issues/5027 is still blocker for MNTR w/ service provider)
My current approach is: just creating mock IActorRef for test and message extraction, routing. and pass the reference to all the actors instead of "actual" shard region,
Although it seems possible to test without MNTR, it would be very nice If we provide an "official" way to test with ShardRegion implicitly integrated with TestKit or PersistenceTestKit.