docs(tests): fix CommentChecker findings across tests/ — 13,392 → 0 (repo-wide scan clean)
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
This commit is contained in:
@@ -13,17 +13,19 @@ using ZB.MOM.WW.ScadaBridge.Communication.Actors;
|
||||
namespace ZB.MOM.WW.ScadaBridge.Communication.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// WP-4: Tests for SiteCommunicationActor message routing to local actors.
|
||||
/// Tests for SiteCommunicationActor message routing to local actors.
|
||||
/// </summary>
|
||||
public class SiteCommunicationActorTests : TestKit
|
||||
{
|
||||
private readonly CommunicationOptions _options = new();
|
||||
|
||||
/// <summary>Initializes the test kit and the actor under test.</summary>
|
||||
public SiteCommunicationActorTests()
|
||||
: base(@"akka.loglevel = DEBUG")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a refresh deployment command is forwarded to the Deployment Manager.</summary>
|
||||
[Fact]
|
||||
public void RefreshDeploymentCommand_ForwardedToDeploymentManager()
|
||||
{
|
||||
@@ -39,6 +41,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
dmProbe.ExpectMsg<RefreshDeploymentCommand>(msg => msg.DeploymentId == "dep1");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that lifecycle commands are forwarded to the Deployment Manager.</summary>
|
||||
[Fact]
|
||||
public void LifecycleCommands_ForwardedToDeploymentManager()
|
||||
{
|
||||
@@ -56,10 +59,11 @@ public class SiteCommunicationActorTests : TestKit
|
||||
dmProbe.ExpectMsg<DeleteInstanceCommand>();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a deployment state query is forwarded to the Deployment Manager.</summary>
|
||||
[Fact]
|
||||
public void DeploymentStateQuery_ForwardedToDeploymentManager()
|
||||
{
|
||||
// DeploymentManager-006: the site-before-redeploy query travels over the
|
||||
// The site-before-redeploy query travels over the
|
||||
// gRPC command/control transport and is routed to the local
|
||||
// Deployment Manager, which owns the deployed-config store.
|
||||
var dmProbe = CreateTestProbe();
|
||||
@@ -78,6 +82,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
// owns the wire, it delegates to an injected ICentralTransport, and those seven sends (plus the
|
||||
// reply routing and the fail-loud fallback) are now covered by SiteCommunicationActorTransportTests.
|
||||
|
||||
/// <summary>Verifies that an event log query without a registered handler returns a failure.</summary>
|
||||
[Fact]
|
||||
public void EventLogQuery_WithoutHandler_ReturnsFailure()
|
||||
{
|
||||
@@ -93,8 +98,9 @@ public class SiteCommunicationActorTests : TestKit
|
||||
ExpectMsg<EventLogQueryResponse>(msg => !msg.Success);
|
||||
}
|
||||
|
||||
// ── Task 5 (#22): central→site Retry/Discard relay for parked cached calls ──
|
||||
// ── Central→site Retry/Discard relay for parked cached calls ──
|
||||
|
||||
/// <summary>Verifies that a retry of a parked operation is forwarded to the parked message handler when one is registered.</summary>
|
||||
[Fact]
|
||||
public void RetryParkedOperation_WithHandler_ForwardedToParkedMessageHandler()
|
||||
{
|
||||
@@ -112,6 +118,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
msg.CorrelationId == "corr-rp" && msg.TrackedOperationId.Equals(id));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a discard of a parked operation is forwarded to the parked message handler when one is registered.</summary>
|
||||
[Fact]
|
||||
public void DiscardParkedOperation_WithHandler_ForwardedToParkedMessageHandler()
|
||||
{
|
||||
@@ -129,6 +136,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
msg.CorrelationId == "corr-dp" && msg.TrackedOperationId.Equals(id));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a retry of a parked operation without a handler replies with a not-applied acknowledgement.</summary>
|
||||
[Fact]
|
||||
public void RetryParkedOperation_WithoutHandler_RepliesNotAppliedAck()
|
||||
{
|
||||
@@ -147,6 +155,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
Assert.NotNull(ack.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a discard of a parked operation without a handler replies with a not-applied acknowledgement.</summary>
|
||||
[Fact]
|
||||
public void DiscardParkedOperation_WithoutHandler_RepliesNotAppliedAck()
|
||||
{
|
||||
@@ -161,15 +170,16 @@ public class SiteCommunicationActorTests : TestKit
|
||||
Assert.NotNull(ack.ErrorMessage);
|
||||
}
|
||||
|
||||
// ── M7 OPC UA cross-cluster routing: Search (T15), WriteTag (T14), Verify (T17) ──
|
||||
// ── OPC UA cross-cluster routing: Search, WriteTag, Verify ──
|
||||
//
|
||||
// Regression guard for the M7 dead-letter defect. These three interactive
|
||||
// Regression guard for the OPC UA dead-letter defect. These three interactive
|
||||
// commands have downstream handlers in DataConnectionManagerActor but were NOT
|
||||
// forwarded through SiteCommunicationActor → Deployment Manager, so they
|
||||
// dead-lettered and the central Ask timed out in the real cluster. They must
|
||||
// forward to the Deployment Manager proxy exactly like BrowseNodeCommand, with
|
||||
// the original Ask sender preserved so the result routes straight back.
|
||||
|
||||
/// <summary>Verifies that a search address space command is forwarded to the Deployment Manager with the original sender preserved.</summary>
|
||||
[Fact]
|
||||
public void SearchAddressSpaceCommand_ForwardedToDeploymentManager_SenderPreserved()
|
||||
{
|
||||
@@ -185,6 +195,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
Assert.Equal(senderProbe.Ref, dmProbe.LastSender);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a write tag request is forwarded to the Deployment Manager with the original sender preserved.</summary>
|
||||
[Fact]
|
||||
public void WriteTagRequest_ForwardedToDeploymentManager_SenderPreserved()
|
||||
{
|
||||
@@ -201,6 +212,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
Assert.Equal(senderProbe.Ref, dmProbe.LastSender);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a verify endpoint command is forwarded to the Deployment Manager with the original sender preserved.</summary>
|
||||
[Fact]
|
||||
public void VerifyEndpointCommand_ForwardedToDeploymentManager_SenderPreserved()
|
||||
{
|
||||
@@ -216,14 +228,18 @@ public class SiteCommunicationActorTests : TestKit
|
||||
Assert.Equal(senderProbe.Ref, dmProbe.LastSender);
|
||||
}
|
||||
|
||||
// ── Communication-018: heartbeat IsActive reflects this node's cluster role ──
|
||||
// ── Heartbeat: IsActive reflects this node's cluster role ──
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that the heartbeat stamps IsActive from the injected active-node check.
|
||||
/// </summary>
|
||||
/// <param name="isActive">The active-node verdict that the injected check returns.</param>
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void Heartbeat_StampsIsActive_FromInjectedCheck(bool isActive)
|
||||
{
|
||||
// Communication-018: HeartbeatMessage.IsActive must reflect the actual
|
||||
// HeartbeatMessage.IsActive must reflect the actual
|
||||
// active/standby role of this node, not a hard-coded `true`. The actor
|
||||
// now takes a Func<bool> override (defaulting to a real Akka.Cluster
|
||||
// leader check in production); tests inject a stub so they do not need
|
||||
@@ -247,12 +263,13 @@ public class SiteCommunicationActorTests : TestKit
|
||||
TimeSpan.FromSeconds(3));
|
||||
}
|
||||
|
||||
// ---- Central→site failover relay (Task 10) ----------------------------------
|
||||
// ---- Central→site failover relay ----------------------------------
|
||||
// The failover action is injected for the same reason isActiveCheck is: performing a
|
||||
// real Cluster.Leave would require Akka.Cluster in the TestKit ActorSystem. These
|
||||
// tests pin the ROUTING and GUARD logic; the actual Leave against a real two-node
|
||||
// site cluster is covered by SiteFailoverRelayTests in the integration suite.
|
||||
|
||||
/// <summary>Verifies that triggering a site failover issues the leave and acknowledges with the target node.</summary>
|
||||
[Fact]
|
||||
public void TriggerSiteFailover_IssuesTheLeave_AndAcksWithTheTarget()
|
||||
{
|
||||
@@ -278,6 +295,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
Assert.Equal("site-site1", roleAskedFor);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that triggering a site failover is refused when there is no peer node.</summary>
|
||||
[Fact]
|
||||
public void TriggerSiteFailover_RefusesWhenThereIsNoPeer()
|
||||
{
|
||||
@@ -294,6 +312,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
Assert.NotNull(ack.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a failover command addressed to another site is refused.</summary>
|
||||
[Fact]
|
||||
public void TriggerSiteFailover_RefusesACommandAddressedToAnotherSite()
|
||||
{
|
||||
@@ -317,6 +336,7 @@ public class SiteCommunicationActorTests : TestKit
|
||||
Assert.False(invoked);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a fault while issuing the leave is reported rather than thrown.</summary>
|
||||
[Fact]
|
||||
public void TriggerSiteFailover_FaultInTheLeave_IsReportedNotThrown()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user