refactor(admin): use CorrelationId wrapper for alarm ack/shelve commands

This commit is contained in:
Joseph Doherty
2026-06-11 09:27:24 -04:00
parent 3a0e0907e4
commit f9932f2d8e
4 changed files with 15 additions and 11 deletions
@@ -43,7 +43,7 @@ public sealed class AdminOperationsActorTests : ControlPlaneActorTestBase
var actor = Sys.ActorOf(AdminOperationsActor.Props(dbFactory, coordinator.Ref, Enumerable.Empty<IDriverProbe>()));
var topicProbe = SubscribeAlarmCommandsProbe();
var correlationId = Guid.NewGuid();
var correlationId = CorrelationId.NewId();
actor.Tell(new AcknowledgeAlarmCommand("alarm-42", "operator-jo", "looking into it", correlationId));
var published = topicProbe.ExpectMsg<AlarmCommand>(TimeSpan.FromSeconds(3));
@@ -69,7 +69,7 @@ public sealed class AdminOperationsActorTests : ControlPlaneActorTestBase
var actor = Sys.ActorOf(AdminOperationsActor.Props(dbFactory, coordinator.Ref, Enumerable.Empty<IDriverProbe>()));
var topicProbe = SubscribeAlarmCommandsProbe();
var correlationId = Guid.NewGuid();
var correlationId = CorrelationId.NewId();
actor.Tell(new ShelveAlarmCommand("alarm-7", "op-kim", ShelveKind.OneShot, UnshelveAtUtc: null, Comment: null, correlationId));
var published = topicProbe.ExpectMsg<AlarmCommand>(TimeSpan.FromSeconds(3));
@@ -94,7 +94,7 @@ public sealed class AdminOperationsActorTests : ControlPlaneActorTestBase
var topicProbe = SubscribeAlarmCommandsProbe();
var unshelveAt = DateTime.UtcNow.AddMinutes(15);
actor.Tell(new ShelveAlarmCommand("alarm-9", "op-lee", ShelveKind.Timed, unshelveAt, Comment: "maint window", Guid.NewGuid()));
actor.Tell(new ShelveAlarmCommand("alarm-9", "op-lee", ShelveKind.Timed, unshelveAt, Comment: "maint window", CorrelationId.NewId()));
var published = topicProbe.ExpectMsg<AlarmCommand>(TimeSpan.FromSeconds(3));
published.AlarmId.ShouldBe("alarm-9");
@@ -116,7 +116,7 @@ public sealed class AdminOperationsActorTests : ControlPlaneActorTestBase
var actor = Sys.ActorOf(AdminOperationsActor.Props(dbFactory, coordinator.Ref, Enumerable.Empty<IDriverProbe>()));
var topicProbe = SubscribeAlarmCommandsProbe();
actor.Tell(new ShelveAlarmCommand("alarm-3", "op-sam", ShelveKind.Unshelve, UnshelveAtUtc: null, Comment: null, Guid.NewGuid()));
actor.Tell(new ShelveAlarmCommand("alarm-3", "op-sam", ShelveKind.Unshelve, UnshelveAtUtc: null, Comment: null, CorrelationId.NewId()));
var published = topicProbe.ExpectMsg<AlarmCommand>(TimeSpan.FromSeconds(3));
published.Operation.ShouldBe("Unshelve");
@@ -135,7 +135,7 @@ public sealed class AdminOperationsActorTests : ControlPlaneActorTestBase
var actor = Sys.ActorOf(AdminOperationsActor.Props(dbFactory, coordinator.Ref, Enumerable.Empty<IDriverProbe>()));
var topicProbe = SubscribeAlarmCommandsProbe();
actor.Tell(new ShelveAlarmCommand("alarm-1", "op-zoe", ShelveKind.Timed, UnshelveAtUtc: null, Comment: null, Guid.NewGuid()));
actor.Tell(new ShelveAlarmCommand("alarm-1", "op-zoe", ShelveKind.Timed, UnshelveAtUtc: null, Comment: null, CorrelationId.NewId()));
var reply = ExpectMsg<ShelveAlarmResult>(TimeSpan.FromSeconds(3));
reply.Ok.ShouldBeFalse();