public void ShardedDaemonProcess_must_not_run_if_the_role_does_not_match_node_role() { Cluster.Get(Sys).Join(Cluster.Get(Sys).SelfAddress); var probe = CreateTestProbe(); var settings = ShardedDaemonProcessSettings.Create(Sys).WithRole("workers"); ShardedDaemonProcess.Get(Sys).Init("roles", 3, id => MyActor.Props(id, probe.Ref), settings); probe.ExpectNoMsg(); }
public void ShardedDaemonProcess_must_start_N_actors_with_unique_ids() { Cluster.Get(Sys).Join(Cluster.Get(Sys).SelfAddress); var probe = CreateTestProbe(); ShardedDaemonProcess.Get(Sys).Init("a", 5, id => MyActor.Props(id, probe.Ref)); var started = probe.ReceiveN(5); started.Count.ShouldBe(5); }
public void ShardedDaemonProcess_must_restart_actors_if_they_stop() { Cluster.Get(Sys).Join(Cluster.Get(Sys).SelfAddress); var probe = CreateTestProbe(); ShardedDaemonProcess.Get(Sys).Init("stop", 2, id => MyActor.Props(id, probe.Ref)); foreach (var started in Enumerable.Range(0, 2).Select(_ => probe.ExpectMsg <Started>())) { started.SelfRef.Tell(Stop.Instance); } // periodic ping every 1s makes it restart Enumerable.Range(0, 2).Select(_ => probe.ExpectMsg <Started>(TimeSpan.FromSeconds(3))); }
public void ShardedDaemonProcess_Should_Init_Actor_Set() { // HACK RunOn(() => FormCluster(_config.First, _config.Second, _config.Third), _config.First); var probe = CreateTestProbe(); ShardedDaemonProcess.Get(Sys).Init("the-fearless", 4, id => ProcessActor.Props(id, probe.Ref)); EnterBarrier("sharded-daemon-process-initialized"); RunOn(() => { var startedIds = Enumerable.Range(0, 4).Select(_ => { var evt = probe.ExpectMsg <ProcessActorEvent>(TimeSpan.FromSeconds(5)); evt.Event.Should().Be("Started"); return(evt.Id); }).ToList(); startedIds.Count.Should().Be(4); }, _config.First); EnterBarrier("sharded-daemon-process-started"); }