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:
@@ -22,7 +22,7 @@ using ZB.MOM.WW.ScadaBridge.TemplateEngine.Flattening;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DeploymentManager.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// WP2.5: bulk site deployment. Pins the properties that make the fan-out safe —
|
||||
/// Bulk site deployment. Pins the properties that make the fan-out safe —
|
||||
/// concurrency is BOUNDED by the configured degree, one slow instance does not stop
|
||||
/// the others completing, a per-instance timeout contains a wedged instance, and
|
||||
/// every instance still gets its own deployment id and its own operation lock.
|
||||
@@ -38,6 +38,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
private readonly IStaleInstanceProbe _staleProbe = Substitute.For<IStaleInstanceProbe>();
|
||||
private readonly OperationLockManager _lockManager = new();
|
||||
|
||||
/// <summary>Initializes the test class with substituted repositories, a flattening pipeline and a stale-instance probe.</summary>
|
||||
public DeploySiteAsyncTests()
|
||||
{
|
||||
_siteRepo.GetSiteByIdAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||
@@ -111,6 +112,8 @@ public class DeploySiteAsyncTests : TestKit
|
||||
NullLogger<DeploymentService>.Instance);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that one slow instance does not stop the others completing and that concurrency stays bounded.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_SlowInstance_OthersStillComplete_AndConcurrencyIsBounded()
|
||||
{
|
||||
@@ -149,6 +152,8 @@ public class DeploySiteAsyncTests : TestKit
|
||||
Assert.DoesNotContain(deploymentIds, id => string.IsNullOrEmpty(id));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a wedged instance times out on its own while the rest of the batch succeeds.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_WedgedInstance_TimesOutAlone_RestSucceed()
|
||||
{
|
||||
@@ -175,6 +180,8 @@ public class DeploySiteAsyncTests : TestKit
|
||||
Assert.Equal("Inst-02", wedged.UniqueName);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a bulk site deploy releases every per-instance operation lock.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_ReleasesEveryOperationLock()
|
||||
{
|
||||
@@ -193,6 +200,8 @@ public class DeploySiteAsyncTests : TestKit
|
||||
Assert.Equal(0, _lockManager.TrackedLockCount);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deploying a site with no instances succeeds with an empty summary.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_SiteWithNoInstances_SucceedsWithEmptySummary()
|
||||
{
|
||||
@@ -207,6 +216,8 @@ public class DeploySiteAsyncTests : TestKit
|
||||
Assert.Empty(result.Value.InstanceResults);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deploying an unknown site returns a failure.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_UnknownSite_ReturnsFailure()
|
||||
{
|
||||
@@ -237,6 +248,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// under the old shape the last instance's token would already be ~2 s old.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_StagesEachTokenImmediatelyBeforeItsOwnSend()
|
||||
{
|
||||
@@ -280,6 +292,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// the process. Their records must also be finalised as Failed rather than left
|
||||
/// InProgress.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_CancelledMidPrepare_ReleasesEveryLock_AndFailsPreparedRecords()
|
||||
{
|
||||
@@ -320,7 +333,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// P7-2: a bulk site deploy must not restart deliberately-stopped equipment.
|
||||
/// A bulk site deploy must not restart deliberately-stopped equipment.
|
||||
///
|
||||
/// <para>
|
||||
/// Deploy is a legal transition out of <c>Disabled</c> and the deploy path
|
||||
@@ -332,6 +345,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// this one" action.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_SkipsDisabledInstances_WithoutDeployingOrReEnablingThem()
|
||||
{
|
||||
@@ -376,7 +390,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// P7-3: phase 1 is serial, so an unreachable site used to cost the batch one
|
||||
/// Phase 1 is serial, so an unreachable site used to cost the batch one
|
||||
/// full 30-second <c>QueryTimeout</c> PER INSTANCE before a single deploy was
|
||||
/// sent — hours for a large site, so the CLI's 5-minute bulk deadline cancelled
|
||||
/// and the next attempt re-armed the same cost. Two bounds close it: a short
|
||||
@@ -389,6 +403,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// whole finding: without the breaker there would be six.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_UnreachableSite_ReconcilesOnceThenSkipsTheRestOfTheBatch()
|
||||
{
|
||||
@@ -457,7 +472,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// P7-6: a bulk site deploy must not redeploy instances whose configuration has
|
||||
/// A bulk site deploy must not redeploy instances whose configuration has
|
||||
/// not changed.
|
||||
///
|
||||
/// <para>
|
||||
@@ -476,6 +491,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// record, no staged config, no command — for the unchanged pair.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_SkipsUpToDateInstances_SoTheirSiteStateIsNeverReset()
|
||||
{
|
||||
@@ -519,10 +535,11 @@ public class DeploySiteAsyncTests : TestKit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// P7-6: <c>force</c> restores the unconditional behaviour for operators whose
|
||||
/// <c>force</c> restores the unconditional behaviour for operators whose
|
||||
/// site state central cannot see — a restored data volume or a rebuilt node
|
||||
/// looks perfectly up to date from central and still needs the push.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_Force_RedeploysUpToDateInstances()
|
||||
{
|
||||
@@ -542,12 +559,14 @@ public class DeploySiteAsyncTests : TestKit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// P7-6 composed with P7-2: <c>force</c> suppresses the up-to-date filter and
|
||||
/// Combining <c>force</c> with the disabled-instance skip: <c>force</c> suppresses the up-to-date filter and
|
||||
/// ONLY that filter. A Disabled instance is never deployed at bulk scope,
|
||||
/// because forcing a bulk push is an operator saying "the site's config may be
|
||||
/// wrong", not "restart the equipment I stopped" — the single-instance deploy
|
||||
/// remains the explicit re-enable action.
|
||||
/// </summary>
|
||||
/// <param name="force">Whether the bulk deploy is forced.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
@@ -576,6 +595,7 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// NOT sufficient — each one would be a silently skipped instance that actually
|
||||
/// needed the deploy.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task DeploySiteAsync_MatchingHashIsNotEnough_WhenTheInstanceStillNeedsDeploying()
|
||||
{
|
||||
@@ -614,6 +634,8 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// <summary>Answers every deploy with Success, recording which instances the site was asked to apply.</summary>
|
||||
private sealed class RecordingSiteActor : ReceiveActor
|
||||
{
|
||||
/// <summary>Initializes the actor with the collection that records applied instance names.</summary>
|
||||
/// <param name="applied">The collection that receives each applied instance's unique name.</param>
|
||||
public RecordingSiteActor(ConcurrentBag<string> applied)
|
||||
{
|
||||
Receive<SiteEnvelope>(env =>
|
||||
@@ -637,6 +659,8 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// </summary>
|
||||
private sealed class SilentQuerySiteActor : ReceiveActor
|
||||
{
|
||||
/// <summary>Initializes the actor with the callback invoked for each unanswered query.</summary>
|
||||
/// <param name="onQuery">The callback invoked each time a state query arrives.</param>
|
||||
public SilentQuerySiteActor(Action onQuery)
|
||||
{
|
||||
Receive<SiteEnvelope>(env =>
|
||||
@@ -663,6 +687,9 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// </summary>
|
||||
private sealed class TokenAgeRecordingSiteActor : ReceiveActor
|
||||
{
|
||||
/// <summary>Initializes the actor with the collection that records token ages and the reply delay.</summary>
|
||||
/// <param name="ages">The collection that receives each command's token age on arrival.</param>
|
||||
/// <param name="delay">The delay before each command is answered.</param>
|
||||
public TokenAgeRecordingSiteActor(ConcurrentBag<TimeSpan> ages, TimeSpan delay)
|
||||
{
|
||||
Receive<SiteEnvelope>(env =>
|
||||
@@ -719,6 +746,10 @@ public class DeploySiteAsyncTests : TestKit
|
||||
/// </summary>
|
||||
private sealed class ThrottledSiteActor : ReceiveActor
|
||||
{
|
||||
/// <summary>Initializes the actor with the concurrency tracker and the optional slow instance.</summary>
|
||||
/// <param name="tracker">The tracker that records the observed concurrency.</param>
|
||||
/// <param name="slowInstanceName">The name of the instance whose reply is delayed, or null for none.</param>
|
||||
/// <param name="slowDelay">How long the named instance's reply is delayed.</param>
|
||||
public ThrottledSiteActor(ConcurrencyTracker tracker, string? slowInstanceName, TimeSpan slowDelay)
|
||||
{
|
||||
Receive<SiteEnvelope>(env =>
|
||||
|
||||
Reference in New Issue
Block a user