Skip to content
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

harden DispatchersSpec #4259

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions src/core/Akka.Tests/Dispatch/DispatchersSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,32 +131,43 @@ public void Dispatchers_must_be_used_when_configured_in_explicit_deployments()
public void Dispatchers_must_be_used_in_deployment_configuration()
{
var actor = Sys.ActorOf(Props.Create<DispatcherNameEcho>(), "echo1");
actor.Tell("what's in a name?");
var expected = "myapp.mydispatcher";
var actual = ExpectMsg<string>(TimeSpan.FromMilliseconds(50));
actual.ShouldBe(expected);

AwaitAssert(() =>
{
actor.Tell("what's in a name?");
var expected = "myapp.mydispatcher";
var actual = ExpectMsg<string>(TimeSpan.FromMilliseconds(50));
actual.ShouldBe(expected);
});
}

[Fact]
public void Dispatchers_must_be_used_in_deployment_configuration_and_trumps_code()
{
var actor = Sys.ActorOf(Props.Create<DispatcherNameEcho>().WithDispatcher("my-pinned-dispatcher"), "echo2");
actor.Tell("what's in a name?");
var expected = "myapp.my-fork-join-dispatcher";
var actual = ExpectMsg<string>(TimeSpan.FromMilliseconds(200));
actual.ShouldBe(expected);

AwaitAssert(() =>
{
actor.Tell("what's in a name?");
var expected = "myapp.my-fork-join-dispatcher";
var actual = ExpectMsg<string>(TimeSpan.FromMilliseconds(200));
actual.ShouldBe(expected);
});
}

[Fact]
public void Dispatchers_must_use_pool_dispatcher_router_of_deployment_config()
{
var pool = Sys.ActorOf(Props.Create<DispatcherNameEcho>().WithRouter(FromConfig.Instance), "pool1");
pool.Tell(new Identify(null));
var routee = ExpectMsg<ActorIdentity>().Subject;
routee.Tell("what's the name?");
var expected = "akka.actor.deployment./pool1.pool-dispatcher";
var actual = ExpectMsg<string>(TimeSpan.FromMilliseconds(50));
actual.ShouldBe(expected);

AwaitAssert(() => {
pool.Tell(new Identify(null));
var routee = ExpectMsg<ActorIdentity>().Subject;
routee.Tell("what's the name?");
var expected = "akka.actor.deployment./pool1.pool-dispatcher";
var actual = ExpectMsg<string>(TimeSpan.FromMilliseconds(50));
actual.ShouldBe(expected);
});
}

[Fact]
Expand Down