Resolve all 46 low-severity architecture review findings
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System.Reflection;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ZB.MOM.WW.ScadaBridge.ClusterInfrastructure;
|
||||
using ZB.MOM.WW.ScadaBridge.Host;
|
||||
using ZB.MOM.WW.ScadaBridge.Host.Actors;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.Host.Tests;
|
||||
|
||||
public class BootstrapCancellationTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task CancelledBootstrap_DoesNotResolveActorSystemOrJoin()
|
||||
{
|
||||
var accessed = 0;
|
||||
var coordinator = new ClusterBootstrapCoordinator(
|
||||
() => { accessed++; throw new InvalidOperationException("must not resolve during shutdown"); },
|
||||
Options.Create(new ClusterOptions { SeedNodes = ["akka.tcp://scadabridge@127.0.0.1:2551"] }),
|
||||
Options.Create(new NodeOptions { NodeHostname = "127.0.0.1", RemotingPort = 2551 }), NullLogger<ClusterBootstrapCoordinator>.Instance);
|
||||
var run = typeof(ClusterBootstrapCoordinator).GetMethod("RunAsync", BindingFlags.Instance | BindingFlags.NonPublic)!;
|
||||
await (Task)run.Invoke(coordinator, [new CancellationToken(true)])!;
|
||||
Assert.Equal(0, accessed);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user