public void A_cluster_must_startup_with_one_dispatcher_thread()
{
// This test failed before fixing https://github.com/akkadotnet/akka.net/issues/1959 when adding a sleep before the
// Await of GetClusterCoreRef in the Cluster extension constructor.
// The reason was that other cluster actors were started too early and
// they also tried to get the Cluster extension and thereby blocking
// dispatcher threads.
// Note that the Cluster extension is started via ClusterActorRefProvider
// before ActorSystem.apply returns, i.e. in the constructor of AkkaSpec.
var totalStartupTime = TimeSpan.FromTicks(MonotonicClock.GetTicks() - _startTime).TotalMilliseconds;
Assert.True(totalStartupTime < (Sys.Settings.CreationTimeout - TimeSpan.FromSeconds(2)).TotalMilliseconds);
Sys.ActorOf(TestProps).Tell("hello");
Sys.ActorOf(TestProps).Tell("hello");
Sys.ActorOf(TestProps).Tell("hello");
var cluster = Cluster.Get(Sys);
totalStartupTime = TimeSpan.FromTicks(MonotonicClock.GetTicks() - _startTime).TotalMilliseconds;
Assert.True(totalStartupTime < (Sys.Settings.CreationTimeout - TimeSpan.FromSeconds(2)).TotalMilliseconds);
ExpectMsg("hello");
ExpectMsg("hello");
ExpectMsg("hello");
}
}