fix(site-runtime): resolve SiteRuntime-017..019 — isolated attribute snapshot for child actors, corrected dispatcher doc, remove dead lifecycle handlers
This commit is contained in:
@@ -3,6 +3,7 @@ using Akka.TestKit.Xunit2;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using ScadaLink.Commons.Messages.Instance;
|
||||
using ScadaLink.Commons.Messages.Lifecycle;
|
||||
using ScadaLink.Commons.Types.Flattening;
|
||||
using ScadaLink.SiteRuntime.Actors;
|
||||
using ScadaLink.SiteRuntime.Persistence;
|
||||
@@ -251,6 +252,33 @@ public class InstanceActorTests : TestKit, IDisposable
|
||||
Assert.Equal("Uncertain", response.Quality);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SiteRuntime-019: the disable/enable lifecycle is owned entirely by the
|
||||
/// Deployment Manager (it stops / re-creates the Instance Actor itself and
|
||||
/// replies to the caller). The Instance Actor must NOT handle
|
||||
/// <see cref="DisableInstanceCommand"/> / <see cref="EnableInstanceCommand"/>
|
||||
/// — the dead handlers that replied with a misleading "success"
|
||||
/// acknowledgement were removed. Sending one to the Instance Actor now goes
|
||||
/// unhandled and produces no <see cref="InstanceLifecycleResponse"/>.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void InstanceActor_DoesNotHandleDisableOrEnableCommands()
|
||||
{
|
||||
var config = new FlattenedConfiguration
|
||||
{
|
||||
InstanceUniqueName = "Pump1",
|
||||
Attributes = []
|
||||
};
|
||||
|
||||
var actor = CreateInstanceActor("Pump1", config);
|
||||
|
||||
actor.Tell(new DisableInstanceCommand("cmd-disable", "Pump1", DateTimeOffset.UtcNow));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(500));
|
||||
|
||||
actor.Tell(new EnableInstanceCommand("cmd-enable", "Pump1", DateTimeOffset.UtcNow));
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(500));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InstanceActor_StaticAttribute_StartsWithGoodQuality()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user