Created
March 24, 2020 22:49
-
-
Save Arkatufus/f5362f1e497fc82aeb3d7816a786b8da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
using System.Threading; | |
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 : core-cluster-svc-0.core-cluster-svc | |
port : 5000 | |
} | |
} | |
} | |
}", | |
@"akka : { | |
cluster : { | |
log-info : on | |
seed-nodes : [ | |
""akka.tcp://System@core-cluster-svc-0.core-cluster-svc:5000"", | |
""akka.tcp://System@core-cluster-svc-1.core-cluster-svc:5000"", | |
""akka.tcp://System@core-cluster-svc-2.core-cluster-svc:5000"" | |
] | |
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 async Task Should_start_ActorSystem() | |
{ | |
var cluster = Cluster.Get(Sys); | |
var tcs = new TaskCompletionSource<Done>(); | |
cluster.RegisterOnMemberUp(() => | |
{ | |
tcs.SetResult(Done.Instance); | |
}); | |
var cts = new CancellationTokenSource(); | |
cts.Token.Register(tcs.SetCanceled); | |
cts.CancelAfter(TimeSpan.FromSeconds(5)); | |
await tcs.Task; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment