private void VerifyProxyMsg(RoleName oldest, RoleName proxyNode, int msg)
{
EnterBarrier("before-" + msg + "-proxy-verified");
// send message to the proxy
RunOn(() =>
{
// make sure that the proxy has received membership changes
// and points to the current singleton
var p = CreateTestProbe();
Within(TimeSpan.FromSeconds(5), () =>
{
AwaitAssert(() =>
{
Sys.ActorSelection("/user/consumerProxy").Tell(Akka.Cluster.Tools.Tests.Singleton.Consumer.Ping.Instance, p.Ref);
p.ExpectMsg<Consumer.Pong>(TimeSpan.FromSeconds(1));
});
});
// send a real message
Sys.ActorSelection("/user/consumerProxy").Tell(msg);
}, proxyNode);
// expect a message on the oldest node
RunOn(() =>
{
ExpectMsg(msg, TimeSpan.FromSeconds(5));
}, oldest);
EnterBarrier("after-" + msg + "-proxy-verified");
}