Skip to content

Instantly share code, notes, and snippets.

@Arkatufus
Created March 25, 2020 01:42
Show Gist options
  • Save Arkatufus/028f958a8366f2e58b3e1b6fbcb73f5b to your computer and use it in GitHub Desktop.
Save Arkatufus/028f958a8366f2e58b3e1b6fbcb73f5b to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Immutable;
using System.Threading.Tasks;
using System.Threading;
using Akka.Actor;
using Akka.Configuration;
using Akka.TestKit;
using Xunit;
using Xunit.Abstractions;
namespace Akka.Cluster.Tests
{
public class Bugfix4353Specs : AkkaSpec
{
private static string[] Hocons =
{
@"akka : {
actor : {
provider : cluster
}
}",
@"akka : {
stdout-loglevel : INFO
loglevel : INFO
log-config-on-start : on
loggers : [""Akka.Event.DefaultLogger""],
actor : {
debug : {
receive : on
autoreceive : on
lifecycle : on
event-stream : on
unhandled : on
}
}
}",
@"akka : {
remote : {
dot-netty : {
tcp : {
log-transport : true
transport-class : ""Akka.Remote.Transport.DotNetty.TcpTransport, Akka.Remote""
transport-protocol : tcp
hostname : 0.0.0.0
public-hostname : localhost
port : 5000
}
}
}
}",
@"akka : {
cluster : {
log-info : on
seed-nodes : [
""akka.tcp://AkkaSpec@localhost:5000"",
""akka.tcp://System@localhost:5001"",
""akka.tcp://System@localhost:5002""
]
roles : [seed]
role : { }
}
}"
};
public static Config Config
{
get
{
var config = ConfigurationFactory.Empty;
foreach (var hocon in Hocons)
{
config = config.WithFallback(ConfigurationFactory.ParseString(hocon));
}
return config;
}
}
public Bugfix4353Specs(ITestOutputHelper output)
: base(Config, output)
{ }
[Fact]
public void Should_start_ActorSystem()
{
var cluster1 = Cluster.Get(Sys);
var system2 = ActorSystem.Create("System",
ConfigurationFactory.ParseString("akka.remote.dot-netty.tcp.port = 5001").WithFallback(Config));
var cluster2 = Cluster.Get(system2);
var system3 = ActorSystem.Create("System",
ConfigurationFactory.ParseString("akka.remote.dot-netty.tcp.port = 5002").WithFallback(Config));
var cluster3 = Cluster.Get(system3);
var callbackProbe = CreateTestProbe(Sys);
cluster1.RegisterOnMemberUp(() =>
{
callbackProbe.Tell("OnMemberUp");
});
callbackProbe.ExpectMsg("OnMemberUp");
system2.Terminate();
system3.Terminate();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment