Skip to content

Commit

Permalink
disable parallelism in Akka.Cluster.Sharding.Tests (#4154)
Browse files Browse the repository at this point in the history
* disable parallelism in Akka.Cluster.Sharding.Tests

* fixed pathing issue

* fixed bug with LeastShardAllocationStrategySpec

* fixed xunit.runner.json import

* fixed race condition with SupervisionSpec

* added comment to explain change
  • Loading branch information
Aaronontheweb committed Jan 22, 2020
1 parent c199182 commit 0b9f716
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
Expand Up @@ -36,4 +36,11 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>

<!-- use the xunit JSON settings file -->
<ItemGroup>
<Content Include="..\..\..\xunit.runner.json" Link="xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Expand Up @@ -18,7 +18,7 @@

namespace Akka.Cluster.Sharding.Tests
{
public class LeastShardAllocationStrategySpec : TestKitBase
public class LeastShardAllocationStrategySpec : TestKit.Xunit2.TestKit
{
/// <summary>
/// Test dictionary, will keep the order of items as they were added
Expand Down Expand Up @@ -132,7 +132,7 @@ IEnumerator IEnumerable.GetEnumerator()
private readonly IActorRef _regionB;
private readonly IActorRef _regionC;

public LeastShardAllocationStrategySpec() : base(new XunitAssertions(), "LeastShardAllocationStrategySpec")
public LeastShardAllocationStrategySpec()
{
_regionA = Sys.ActorOf(Props.Empty, "regionA");
_regionB = Sys.ActorOf(Props.Empty, "regionB");
Expand Down
15 changes: 12 additions & 3 deletions src/contrib/cluster/Akka.Cluster.Sharding.Tests/SupervisionSpec.cs
Expand Up @@ -133,9 +133,18 @@ public void SupervisionSpec_for_a_sharded_actor_must_allow_passivation()
region.Tell(new Msg(10, "passivate"));
ExpectTerminated(response.Self);

// This would fail before as sharded actor would be stuck passivating
region.Tell(new Msg(10, "hello"));
ExpectMsg<Response>(TimeSpan.FromSeconds(20));
Within(TimeSpan.FromSeconds(10), () =>
{
// This would fail before as sharded actor would be stuck passivating
// Need to use AwaitAssert here - message can be sent the the BackOffSupervisor, which is now
// terminating but still alive, but its child (the ultimate recipient of the message) is dead
// and this message will go to DeadLetters.
AwaitAssert(() =>
{
region.Tell(new Msg(10, "hello"));
ExpectMsg<Response>();
});
});
}
}
}

0 comments on commit 0b9f716

Please sign in to comment.