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:
+42
-2
@@ -8,7 +8,7 @@ using ZB.MOM.WW.ScadaBridge.TestSupport;
|
||||
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests.Persistence;
|
||||
|
||||
/// <summary>
|
||||
/// Task 8, site-secrets artifact deploy: site-local <c>deployed_secrets</c>
|
||||
/// Site-secrets artifact deploy: site-local <c>deployed_secrets</c>
|
||||
/// (LocalDb-replicated ciphertext) and <c>mirrored_secrets</c> (node-local ledger) stores.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -20,19 +20,25 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
private readonly TestLocalDb _localDb;
|
||||
private SiteStorageService _storage = null!;
|
||||
|
||||
/// <summary>Initializes the test class and creates the backing storage.</summary>
|
||||
public DeployedSecretsStorageTests()
|
||||
{
|
||||
_localDb = TestLocalDb.CreateTemp("deployed-secrets");
|
||||
}
|
||||
|
||||
/// <summary>Prepares the fixture before the tests run.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
_storage = new SiteStorageService(_localDb.Db, NullLogger<SiteStorageService>.Instance);
|
||||
await _storage.InitializeAsync();
|
||||
}
|
||||
|
||||
/// <summary>Releases the resources used by this instance asynchronously.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public Task DisposeAsync() => Task.CompletedTask;
|
||||
|
||||
/// <summary>Releases the resources used by this instance.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
var path = _localDb.Path;
|
||||
@@ -42,6 +48,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
|
||||
// ── deployed_secrets: full-set upsert / soft-delete reconciliation ──
|
||||
|
||||
/// <summary>Verifies that an upsert is treated as the full set and marks absent rows as removed.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Upsert_IsFullSet_MarksAbsentRowsRemoved()
|
||||
{
|
||||
@@ -57,6 +65,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.True(rows.Single(r => r.Name == "B").IsRemoved);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the first upsert applies every row and removes nothing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Upsert_FirstCall_AppliesEveryRow_AndRemovesNothing()
|
||||
{
|
||||
@@ -67,6 +77,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(removed);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a removed row is not reported as removed again when the set is re-applied.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Upsert_ReAppliedRow_IsNotReportedAsRemovedTwice()
|
||||
{
|
||||
@@ -80,6 +92,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(removedSecond);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a removed row can be re-applied and flips back to not removed.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Upsert_RowThatWasRemoved_CanBeReAppliedAndFlipsBackToNotRemoved()
|
||||
{
|
||||
@@ -98,6 +112,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(2, b.Secret.Revision);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that upserting an empty set marks every existing row as removed.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task Upsert_EmptySet_MarksEveryExistingRowRemoved()
|
||||
{
|
||||
@@ -112,6 +128,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.All(rows, r => Assert.True(r.IsRemoved));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that reading the deployed secrets round-trips every field of the secret artifact.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetDeployedSecretsAsync_RoundTripsEveryFieldOfTheSecretArtifact()
|
||||
{
|
||||
@@ -138,6 +156,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(art.Description, row.Secret.Description);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that reading the deployed secrets includes rows marked as removed.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task GetDeployedSecretsAsync_IncludesRemovedRows()
|
||||
{
|
||||
@@ -153,6 +173,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
|
||||
// ── security: row_json holds only base64 ciphertext, never plaintext ──
|
||||
|
||||
/// <summary>Verifies that the stored row JSON deserializes to a secret artifact with no extra properties.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RowJson_DeserializesToSecretArtifact_WithNoExtraProperties()
|
||||
{
|
||||
@@ -204,6 +226,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(expected, propertyNames);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the stored row JSON encodes every byte-array field as Base64 text.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RowJson_EncodesEveryByteArrayField_AsBase64Text()
|
||||
{
|
||||
@@ -244,6 +268,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
|
||||
// ── mirrored_secrets: node-local ledger ──
|
||||
|
||||
/// <summary>Verifies that a mirrored secret that is set can be read back.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MirroredSecrets_SetThenGet_RoundTrips()
|
||||
{
|
||||
@@ -256,6 +282,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(3, row.Revision);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that setting a mirrored secret twice updates the existing entry.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MirroredSecrets_Set_IsUpsert()
|
||||
{
|
||||
@@ -268,6 +296,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(2, row.Revision);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that removing a mirrored secret deletes its ledger row.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MirroredSecrets_Remove_DeletesTheLedgerRow()
|
||||
{
|
||||
@@ -278,6 +308,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(await _storage.GetMirroredSecretsAsync());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that removing an unknown mirrored secret name does nothing.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MirroredSecrets_Remove_OfAnUnknownName_IsANoOp()
|
||||
{
|
||||
@@ -286,6 +318,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Empty(await _storage.GetMirroredSecretsAsync());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the mirrored-secrets ledger is independent of the deployed secrets.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task MirroredSecrets_IsIndependentOf_DeployedSecrets()
|
||||
{
|
||||
@@ -304,8 +338,10 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal("A", mirrored.Name);
|
||||
}
|
||||
|
||||
// ── secret_mirror_status (review finding M1) ──
|
||||
// ── secret_mirror_status (standby mirror failures) ──
|
||||
|
||||
/// <summary>Verifies that mirror status round-trips with one row per node, ordered by node name.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SecretMirrorStatus_RoundTrips_OneRowPerNode_OrderedByNodeName()
|
||||
{
|
||||
@@ -324,6 +360,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(at, rows[1].CheckedAtUtc);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that setting the mirror status updates that node's existing row.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SecretMirrorStatus_Set_UpsertsTheNodesRow()
|
||||
{
|
||||
@@ -336,6 +374,8 @@ public class DeployedSecretsStorageTests : IAsyncLifetime, IDisposable
|
||||
Assert.Equal(at.AddHours(1), row.CheckedAtUtc);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an unparseable mirror status row reads as a failure rather than as healthy.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task SecretMirrorStatus_UnparseableRow_ReadsAsAFailure_NotAsHealthy()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user