-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - Updated tests in ClusterClientConfigSpec - Changed range check in ClusterClientSettings * - Added ClusterClientStartSpec * Disabled new spec
- Loading branch information
1 parent
65807b4
commit 9c48f78
Showing
4 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
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
135 changes: 135 additions & 0 deletions
135
.../cluster/Akka.Cluster.Tools.Tests.MultiNode/ClusterClient/ClusterClientStartSpecConfig.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using Akka.Actor; | ||
using Akka.Cluster.TestKit; | ||
using Akka.Cluster.Tools.Client; | ||
using Akka.Cluster.Tools.PublishSubscribe; | ||
using Akka.Cluster.Tools.PublishSubscribe.Internal; | ||
using Akka.Configuration; | ||
using Akka.Remote.TestKit; | ||
using FluentAssertions; | ||
|
||
namespace Akka.Cluster.Tools.Tests.MultiNode.Client | ||
{ | ||
|
||
public class ClusterClientStartSpecConfig : MultiNodeConfig | ||
{ | ||
public RoleName Client { get; } | ||
public RoleName First { get; } | ||
public RoleName Second { get; } | ||
|
||
public ClusterClientStartSpecConfig() | ||
{ | ||
Client = Role("client"); | ||
First = Role("first"); | ||
Second = Role("second"); | ||
|
||
CommonConfig = ConfigurationFactory.ParseString(@" | ||
akka.loglevel = INFO | ||
akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"" | ||
akka.remote.log-remote-lifecycle-events = off | ||
akka.cluster.client { | ||
heartbeat-interval = 1s | ||
acceptable-heartbeat-pause = 1s | ||
reconnect-timeout = 60s | ||
receptionist.number-of-contacts = 1 | ||
} | ||
akka.test.filter-leeway = 10s | ||
") | ||
.WithFallback(ClusterClientReceptionist.DefaultConfig()) | ||
.WithFallback(DistributedPubSub.DefaultConfig()); | ||
} | ||
|
||
public class Service : ReceiveActor | ||
{ | ||
public Service() | ||
{ | ||
ReceiveAny(msg => Sender.Tell(msg)); | ||
} | ||
} | ||
|
||
public class ClusterClientStartMultiNode1 : ClusterClientStartSpec { } | ||
public class ClusterClientStartMultiNode2 : ClusterClientStartSpec { } | ||
public class ClusterClientStartMultiNode3 : ClusterClientStartSpec { } | ||
|
||
public abstract class ClusterClientStartSpec : MultiNodeClusterSpec | ||
{ | ||
private readonly ClusterClientStartSpecConfig _config; | ||
|
||
protected ClusterClientStartSpec() : this(new ClusterClientStartSpecConfig()) | ||
{ | ||
} | ||
|
||
protected ClusterClientStartSpec(ClusterClientStartSpecConfig config) : base(config) | ||
{ | ||
_config = config; | ||
} | ||
|
||
protected override int InitialParticipantsValueFactory => 3; | ||
|
||
private ImmutableHashSet<ActorPath> InitialContacts | ||
{ | ||
get | ||
{ | ||
//return new List<ActorPath>().ToImmutableHashSet(); | ||
return ImmutableHashSet | ||
.Create(_config.First, _config.Second) | ||
.Select(r => Node(r) / "system" / "receptionist") | ||
.ToImmutableHashSet(); | ||
} | ||
} | ||
|
||
[MultiNodeFact(Skip = "Disable due to known issues with this spec which are currently under investigation by ArjenSmitss")] | ||
public void ClusterClientStartSpecs() | ||
{ | ||
Start_Cluster(); | ||
ClusterClient_can_start_with_zero_buffer(); | ||
} | ||
|
||
public void Start_Cluster() | ||
{ | ||
Within(30.Seconds(), () => | ||
{ | ||
AwaitClusterUp(_config.First, _config.Second); | ||
|
||
//start our test service | ||
RunOn(() => | ||
{ | ||
var service = Sys.ActorOf(Props.Create(() => new ClusterClientStopSpecConfig.Service()), "testService"); | ||
|
||
//here we explicitly do _not_ register the service with the cluster receptionist to force the clusterclient in buffer mode | ||
//ClusterClientReceptionist.Get(Sys).RegisterService(service); | ||
}, _config.First, _config.Second); | ||
|
||
EnterBarrier("receptionist-started"); | ||
}); | ||
} | ||
|
||
public void ClusterClient_can_start_with_zero_buffer() | ||
{ | ||
Within(30.Seconds(), () => | ||
{ | ||
//start the cluster client | ||
RunOn(() => | ||
{ | ||
var c = Sys.ActorOf(ClusterClient.Props(ClusterClientSettings.Create(Sys).WithBufferSize(0).WithInitialContacts(InitialContacts)), "client1"); | ||
//check for the debug log message that the cluster client will output in case of an 0 buffersize | ||
EventFilter.Debug(start: "Receptionist not available and buffering is disabled, dropping message").ExpectOne( | ||
() => | ||
{ | ||
c.Tell(new ClusterClient.Send("/user/testService", "hello")); | ||
}); | ||
|
||
//ExpectMsg<string>(3.Seconds()).Should().Be("hello"); | ||
|
||
|
||
ExpectTerminated(c, 10.Seconds()); | ||
}, _config.Client); | ||
|
||
EnterBarrier("end-of-test"); | ||
}); | ||
} | ||
} | ||
} | ||
} |
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
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