public void Persistent_cluster_shards_should_ensure_rebalance_restarts_shards()
{
Persistent_cluster_shards_should_be_migrated_to_new_regions_upon_region_failure();
Within(TimeSpan.FromSeconds(50), () =>
{
RunOn(() =>
{
for (int i = 1; i <= 12; i++)
_rebalancingPersistentRegion.Value.Tell(new Counter.EntityEnvelope(i, Counter.Increment.Instance));
for (int i = 1; i <= 12; i++)
{
_rebalancingPersistentRegion.Value.Tell(new Counter.Get(i));
ExpectMsg(1);
}
}, _fourth);
EnterBarrier("entities-started");
RunOn(() =>
{
var r = _rebalancingPersistentRegion.Value;
}, _fifth);
EnterBarrier("fifth-joined-shard");
RunOn(() =>
{
AwaitAssert(() =>
{
var count = 0;
for (int i = 2; i <= 12; i++)
{
var entity = Sys.ActorSelection(_rebalancingPersistentRegion.Value.Path / (i % 12).ToString() / i.ToString());
entity.Tell(new Identify(i));
var msg = ReceiveOne(TimeSpan.FromSeconds(3)) as ActorIdentity;
if (msg != null && msg.Subject != null)
count++;
}
Assert.True(count >= 2);
});
}, _fifth);
EnterBarrier("after-16");
});
}