Akka.Remote.Tests.MultiNode.RemoteRestartedQuarantinedSpec.A_restarted_quarantined_system_should_not_crash_the_other_system C# (CSharp) Метод

A_restarted_quarantined_system_should_not_crash_the_other_system() приватный Метод

private A_restarted_quarantined_system_should_not_crash_the_other_system ( ) : void
Результат void
        public void A_restarted_quarantined_system_should_not_crash_the_other_system()
        {
            Sys.ActorOf<RemoteRestartedQuarantinedMultiNetSpec.Subject>("subject");
            EnterBarrier("subject-started");

            RunOn(() =>
            {
                var secondAddress = Node(_config.Second).Address;
                var uid = _identifyWithUid(_config.Second, "subject").Item1;

                RARP.For(Sys).Provider.Transport.Quarantine(Node(_config.Second).Address, uid);

                EnterBarrier("quarantined");
                EnterBarrier("still-quarantined");

                TestConductor.Shutdown(_config.Second).Wait();

                Within(TimeSpan.FromSeconds(30), () =>
                {
                    AwaitAssert(() =>
                    {
                        Sys.ActorSelection(new RootActorPath(secondAddress)/"user"/"subject")
                            .Tell(new Identify("subject"));
                        ExpectMsg<ActorIdentity>(i => i.Subject != null, TimeSpan.FromSeconds(1));
                    });
                });

                Sys.ActorSelection(new RootActorPath(secondAddress) / "user" / "subject").Tell("shutdown");
            }, _config.First);

            RunOn(() =>
            {
                var addr = ((ExtendedActorSystem) Sys).Provider.DefaultAddress;
                var firstAddress = Node(_config.First).Address;
                Sys.EventStream.Subscribe(TestActor, typeof (ThisActorSystemQuarantinedEvent));

                var actorRef = _identifyWithUid(_config.First, "subject").Item2;

                EnterBarrier("quarantined");

                // Check that quarantine is intact
                Within(TimeSpan.FromSeconds(10), () =>
                {
                    AwaitAssert(() =>
                    {
                        EventFilter.Warning(null, null, "The remote system has quarantined this system")
                            .ExpectOne(() => actorRef.Tell("boo!"));
                    });
                });

                ExpectMsg<ThisActorSystemQuarantinedEvent>(TimeSpan.FromSeconds(10));

                EnterBarrier("still-quarantined");

                Sys.WhenTerminated.Wait(TimeSpan.FromSeconds(10));

                var sb = new StringBuilder()
                    .AppendLine("akka.remote.retry-gate-closed-for = 0.5 s")
                    .AppendLine("akka.remote.helios.tcp {")
                    .AppendLine("hostname = " + addr.Host)
                    .AppendLine("port = " + addr.Port)
                    .AppendLine("}");
                var freshSystem = ActorSystem.Create(Sys.Name,
                    ConfigurationFactory.ParseString(sb.ToString()).WithFallback(Sys.Settings.Config));

                var probe = CreateTestProbe(freshSystem);

                freshSystem.ActorSelection(new RootActorPath(firstAddress)/"user"/"subject")
                    .Tell(new Identify("subject"), probe.Ref);

                // TODO sometimes it takes long time until the new connection is established,
                //      It seems like there must first be a transport failure detector timeout, that triggers
                //      "No response from remote. Handshake timed out or transport failure detector triggered"
                probe.ExpectMsg<ActorIdentity>(i => i.Subject != null, TimeSpan.FromSeconds(30));

                freshSystem.ActorOf<RemoteRestartedQuarantinedMultiNetSpec.Subject>("subject");

                freshSystem.WhenTerminated.Wait(TimeSpan.FromSeconds(10));
            }, _config.Second);
        }
    }