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:
+23
-5
@@ -10,7 +10,7 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// WP2.1b — the DataConnectionActor against a batch-capable adapter: chunked subscribe,
|
||||
/// The DataConnectionActor against a batch-capable adapter: chunked subscribe,
|
||||
/// chunked/bounded re-subscribe, the seed deadline, batched tag-resolution probes, the
|
||||
/// partial-failure surface and the coalesced quality push. The existing suite covers the
|
||||
/// same actor against a NON batch-capable adapter, which keeps the per-tag fallback pinned.
|
||||
@@ -42,11 +42,12 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
|
||||
private static string[] Tags(int count) => Enumerable.Range(1, count).Select(i => $"tag{i}").ToArray();
|
||||
|
||||
/// <summary>Verifies that subscribing issues one adapter round trip per chunk rather than one per tag.</summary>
|
||||
[Fact]
|
||||
public void Subscribe_IssuesOneAdapterRoundTripPerChunk_NotPerTag()
|
||||
{
|
||||
// 12 tags at SubscribeBatchSize 5 → 3 batch calls (5/5/2) and ZERO per-tag
|
||||
// subscribes. This is finding #3: the old path was one adapter call (and one OPC UA
|
||||
// subscribes. The old path was one adapter call (and one OPC UA
|
||||
// ApplyChanges) per tag.
|
||||
var adapter = new FakeBatchDataConnection();
|
||||
var actor = CreateActor(adapter, Options(), "batch-chunking");
|
||||
@@ -60,6 +61,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
Assert.Equal(0, Volatile.Read(ref adapter.SingleSubscribeCalls));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that seeding uses chunked bulk reads rather than per-tag reads.</summary>
|
||||
[Fact]
|
||||
public void Seed_UsesChunkedBulkReads_NotPerTagReads()
|
||||
{
|
||||
@@ -78,6 +80,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
ExpectMsg<TagValueUpdate>(u => u.Quality == QualityCode.Good, TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that hanging seed reads return at the overall deadline and the subscribe is still acknowledged.</summary>
|
||||
[Fact]
|
||||
public void Seed_HangingReads_ReturnAtTheOverallDeadline_AndTheSubscribeIsStillAcked()
|
||||
{
|
||||
@@ -102,6 +105,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
ExpectNoMsg(TimeSpan.FromMilliseconds(200));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a per-tag partial failure marks that tag bad while the request still succeeds.</summary>
|
||||
[Fact]
|
||||
public void PartialFailure_PerTagRow_MarksTagBad_ButTheRequestStillSucceeds()
|
||||
{
|
||||
@@ -117,6 +121,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
ExpectMsg<SubscribeTagsResponse>(m => m.Success, TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a batch that throws at connection level fails the request and drives a reconnect.</summary>
|
||||
[Fact]
|
||||
public void ThrownBatch_AtConnectionLevel_FailsTheRequestAndDrivesReconnect()
|
||||
{
|
||||
@@ -135,6 +140,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
ExpectMsg<ConnectionQualityChanged>(q => q.Quality == QualityCode.Bad, TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that tag-resolution probes are batched rather than issued one per tag.</summary>
|
||||
[Fact]
|
||||
public void ResolutionProbes_AreBatched_NotOnePerTag()
|
||||
{
|
||||
@@ -162,6 +168,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
Assert.Equal(0, Volatile.Read(ref adapter.SingleSubscribeCalls));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that resolution probes back off so a dead device is not probed at the full rate.</summary>
|
||||
[Fact]
|
||||
public void ResolutionProbes_BackOff_SoADeadDeviceIsNotProbedAtFullRate()
|
||||
{
|
||||
@@ -196,7 +203,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Row-40 house pattern adapted for a RATE assertion: proves a monotonically-increasing
|
||||
/// House pattern adapted for a RATE assertion: proves a monotonically-increasing
|
||||
/// count stays within <c>[minInclusive, maxInclusive]</c> across the whole
|
||||
/// <paramref name="window"/>, rather than a single blind sleep-then-sample at the end.
|
||||
/// The upper bound is enforced continuously (fails fast the instant it is exceeded,
|
||||
@@ -225,7 +232,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Row-40 house pattern for an ABSENCE assertion (mirrors the Medium-wave
|
||||
/// House pattern for an ABSENCE assertion (mirrors the Medium-wave
|
||||
/// <c>SiteAlarmAggregatorActorTests.AssertHoldsFor</c> treatment): proves
|
||||
/// <paramref name="holds"/> keeps being true for the whole <paramref name="window"/> by
|
||||
/// polling, rather than a single blind <c>Thread.Sleep(window)</c> followed by one
|
||||
@@ -246,6 +253,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that quality counters are pushed only on a transition and are coalesced.</summary>
|
||||
[Fact]
|
||||
public void QualityCounters_ArePushedOnTransitionOnly_AndCoalesced()
|
||||
{
|
||||
@@ -279,6 +287,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
"the coalesced push must not repeat");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that quality counters are flushed immediately on disconnect.</summary>
|
||||
[Fact]
|
||||
public void QualityCounters_FlushImmediatelyOnDisconnect()
|
||||
{
|
||||
@@ -301,6 +310,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
TimeSpan.FromSeconds(3));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that unsubscribing releases every handle in a single round trip.</summary>
|
||||
[Fact]
|
||||
public void Unsubscribe_ReleasesEveryHandleInOneRoundTrip()
|
||||
{
|
||||
@@ -317,6 +327,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
Assert.Equal(6, released!.Count);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a reconnect re-subscribes in paced chunks and restores the resolved count.</summary>
|
||||
[Fact]
|
||||
public void Reconnect_ReSubscribesInPacedChunks_AndRestoresTheResolvedCount()
|
||||
{
|
||||
@@ -353,6 +364,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
TimeSpan.FromSeconds(10));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a resolution probe completing after an unsubscribe is discarded and its handle released.</summary>
|
||||
[Fact]
|
||||
public void ResolutionProbe_CompletingAfterUnsubscribe_IsDiscarded_AndItsHandleIsReleased()
|
||||
{
|
||||
@@ -432,6 +444,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
Assert.Equal(0, afterFinalUnsubscribe.ResolvedTags);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a reconnect re-subscribe completing after an unsubscribe is discarded and its handle released.</summary>
|
||||
[Fact]
|
||||
public void ReconnectResubscribe_CompletingAfterUnsubscribe_IsDiscarded_AndItsHandleIsReleased()
|
||||
{
|
||||
@@ -483,7 +496,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
|
||||
// ── Tag-resolution health counts: derived from the per-tag counted set ──
|
||||
//
|
||||
// Arch-review remediation residual #1. TotalSubscribedTags / ResolvedTags used to be
|
||||
// TotalSubscribedTags / ResolvedTags used to be
|
||||
// two int fields incremented and decremented at five independent sites. The reconnect
|
||||
// path cleared the very maps those decrements keyed off (_subscriptionIds and
|
||||
// _unresolvedTags), so an unsubscribe landing inside a reconnect window matched NEITHER
|
||||
@@ -491,6 +504,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
// under churn. They are now derived at report time from _instancesByTag (the per-tag
|
||||
// counted set) and _subscriptionIds, which makes that class of drift unrepresentable.
|
||||
|
||||
/// <summary>Verifies that an unsubscribe inside a reconnect window does not leak a subscribed tag into the counts.</summary>
|
||||
[Fact]
|
||||
public void TagResolutionCounts_UnsubscribeInsideAReconnectWindow_DoesNotLeakASubscribedTag()
|
||||
{
|
||||
@@ -546,6 +560,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a shared tag unsubscribed inside a reconnect window still counts for the other instance.</summary>
|
||||
[Fact]
|
||||
public void TagResolutionCounts_SharedTagUnsubscribedInsideAReconnectWindow_StillCountsForTheOtherInstance()
|
||||
{
|
||||
@@ -599,6 +614,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
AwaitCondition(() => adapter.UnsubscribeBatches.Any(b => b.Count == 1), TimeSpan.FromSeconds(10));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that after a connection-level failure and recovery the resolved count stays within the total.</summary>
|
||||
[Fact]
|
||||
public void TagResolutionCounts_ConnectionLevelFailureThenRecovery_KeepResolvedWithinTheTotal()
|
||||
{
|
||||
@@ -645,6 +661,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
Assert.Equal(0, afterUnsubscribe.ResolvedTags);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that tag-resolution counts stay correct across plain subscribe and unsubscribe cycles.</summary>
|
||||
[Fact]
|
||||
public void TagResolutionCounts_SurvivePlainSubscribeUnsubscribeCycles()
|
||||
{
|
||||
@@ -680,6 +697,7 @@ public class DataConnectionActorBatchTests : TestKit
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that tag-resolution counts are carried through a completed reconnect re-subscribe.</summary>
|
||||
[Fact]
|
||||
public void TagResolutionCounts_AreCarriedThroughACompletedReconnectReSubscribe()
|
||||
{
|
||||
|
||||
+5
-5
@@ -10,7 +10,7 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// Arch-review 2026-08-19 <b>P2-6</b> — the <c>AdapterDisconnected</c> gap in the
|
||||
/// The <c>AdapterDisconnected</c> gap in the
|
||||
/// Connecting/Reconnecting states, and the generation fence that keeps a swapped-out adapter's
|
||||
/// disconnect from disturbing its replacement.
|
||||
///
|
||||
@@ -28,7 +28,7 @@ namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
///
|
||||
/// <para>
|
||||
/// The fix must not weaken the Medium-wave generation fencing: a disconnect raised by an adapter
|
||||
/// that has since been swapped out (failover, or the row-97 in-place reconfigure) must still be
|
||||
/// that has since been swapped out (failover, or the in-place reconfigure) must still be
|
||||
/// dropped, or the endpoint the operator has just corrected AWAY from could knock the healthy
|
||||
/// replacement back into a reconnect cycle.
|
||||
/// </para>
|
||||
@@ -113,7 +113,7 @@ public class DataConnectionDisconnectRaceTests : TestKit
|
||||
{
|
||||
const string name = "disconnect-before-connect-result";
|
||||
var firstConnect = new TaskCompletionSource();
|
||||
// Attempt #2 onward never completes, so "the actor did not go Connected on the dead
|
||||
// Attempt 2 onward never completes, so "the actor did not go Connected on the dead
|
||||
// session" is a stable assertion rather than a race against the next retry tick.
|
||||
var laterConnects = new TaskCompletionSource();
|
||||
var connects = 0;
|
||||
@@ -158,7 +158,7 @@ public class DataConnectionDisconnectRaceTests : TestKit
|
||||
const string name = "disconnect-before-reconnect-result";
|
||||
var firstConnect = new TaskCompletionSource();
|
||||
var secondConnect = new TaskCompletionSource();
|
||||
// Attempt #3 onward never completes, so the actor parks in Reconnecting and the
|
||||
// Attempt 3 onward never completes, so the actor parks in Reconnecting and the
|
||||
// "did not go Connected on the dead session" assertion is stable rather than a race
|
||||
// against the next retry tick.
|
||||
var laterConnects = new TaskCompletionSource();
|
||||
@@ -181,7 +181,7 @@ public class DataConnectionDisconnectRaceTests : TestKit
|
||||
AwaitCondition(() => HealthTransitions(name, ConnectionHealth.Connected) >= 1,
|
||||
TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(10));
|
||||
|
||||
// Drop while Connected → Reconnecting, and the retry timer launches attempt #2.
|
||||
// Drop while Connected → Reconnecting, and the retry timer launches attempt 2.
|
||||
adapter.Disconnected += Raise.Event<Action>();
|
||||
AwaitCondition(() => Volatile.Read(ref connects) >= 2,
|
||||
TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(10));
|
||||
|
||||
+10
-2
@@ -11,7 +11,7 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// Task 10 (opcua-tag-browser): the site-side
|
||||
/// OPC UA tag browser: the site-side
|
||||
/// <see cref="DataConnectionManagerActor"/> + child
|
||||
/// <see cref="DataConnectionActor"/> together resolve
|
||||
/// <see cref="BrowseNodeCommand"/> against the live adapter and surface
|
||||
@@ -29,6 +29,7 @@ public class DataConnectionManagerBrowseHandlerTests : TestKit
|
||||
private readonly ISiteHealthCollector _healthCollector;
|
||||
private readonly DataConnectionOptions _options;
|
||||
|
||||
/// <summary>Initializes a new instance of <c>DataConnectionManagerBrowseHandlerTests</c>.</summary>
|
||||
public DataConnectionManagerBrowseHandlerTests()
|
||||
: base(@"akka.loglevel = WARNING")
|
||||
{
|
||||
@@ -41,6 +42,7 @@ public class DataConnectionManagerBrowseHandlerTests : TestKit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Verifies that unknown connection name returns connection not found.</summary>
|
||||
[Fact]
|
||||
public void Unknown_connection_name_returns_ConnectionNotFound()
|
||||
{
|
||||
@@ -58,6 +60,7 @@ public class DataConnectionManagerBrowseHandlerTests : TestKit
|
||||
Assert.Empty(reply.Children);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that non browsable adapter returns not browsable.</summary>
|
||||
[Fact]
|
||||
public void Non_browsable_adapter_returns_NotBrowsable()
|
||||
{
|
||||
@@ -88,6 +91,7 @@ public class DataConnectionManagerBrowseHandlerTests : TestKit
|
||||
Assert.Empty(reply.Children);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that success path returns mapped children.</summary>
|
||||
[Fact]
|
||||
public void Success_path_returns_mapped_children()
|
||||
{
|
||||
@@ -130,6 +134,7 @@ public class DataConnectionManagerBrowseHandlerTests : TestKit
|
||||
Assert.False(reply.Truncated);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that connection not connected exception maps to connection not connected.</summary>
|
||||
[Fact]
|
||||
public void ConnectionNotConnectedException_maps_to_ConnectionNotConnected()
|
||||
{
|
||||
@@ -163,6 +168,7 @@ public class DataConnectionManagerBrowseHandlerTests : TestKit
|
||||
Assert.Empty(reply.Children);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that not supported exception maps to not browsable carrying message.</summary>
|
||||
[Fact]
|
||||
public void NotSupportedException_maps_to_NotBrowsable_carrying_message()
|
||||
{
|
||||
@@ -207,6 +213,7 @@ public class DataConnectionManagerBrowseHandlerTests : TestKit
|
||||
Assert.Empty(reply.Children);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that oversized child list is capped to frame budget and marked truncated.</summary>
|
||||
[Fact]
|
||||
public void Oversized_child_list_is_capped_to_frame_budget_and_marked_truncated()
|
||||
{
|
||||
@@ -254,10 +261,11 @@ public class DataConnectionManagerBrowseHandlerTests : TestKit
|
||||
Assert.True(keptBytes <= byteBudget, $"kept estimate {keptBytes} exceeds budget {byteBudget}");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that continuation token round trips through the browse handler.</summary>
|
||||
[Fact]
|
||||
public void ContinuationToken_round_trips_through_the_browse_handler()
|
||||
{
|
||||
// Task B3 (T15): the BrowseNext continuation token must thread through the
|
||||
// The BrowseNext continuation token must thread through the
|
||||
// actor plumbing in both directions — the inbound command's token must reach
|
||||
// the adapter, and the adapter's returned token must be surfaced on the reply
|
||||
// so the UI can request the next page. We capture the token the adapter is
|
||||
|
||||
+5
@@ -30,6 +30,7 @@ public class DataConnectionManagerReadTagValuesHandlerTests : TestKit
|
||||
private readonly ISiteHealthCollector _healthCollector;
|
||||
private readonly DataConnectionOptions _options;
|
||||
|
||||
/// <summary>Initializes the actor system and fakes shared by the read-tag-values handler tests.</summary>
|
||||
public DataConnectionManagerReadTagValuesHandlerTests()
|
||||
: base(@"akka.loglevel = WARNING")
|
||||
{
|
||||
@@ -42,6 +43,7 @@ public class DataConnectionManagerReadTagValuesHandlerTests : TestKit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an unknown connection name returns a ConnectionNotFound outcome.</summary>
|
||||
[Fact]
|
||||
public void Unknown_connection_name_returns_ConnectionNotFound()
|
||||
{
|
||||
@@ -59,6 +61,7 @@ public class DataConnectionManagerReadTagValuesHandlerTests : TestKit
|
||||
Assert.Empty(reply.Outcomes);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an adapter that is not connected returns a ConnectionNotConnected outcome.</summary>
|
||||
[Fact]
|
||||
public void Adapter_not_connected_returns_ConnectionNotConnected()
|
||||
{
|
||||
@@ -94,6 +97,7 @@ public class DataConnectionManagerReadTagValuesHandlerTests : TestKit
|
||||
adapter.DidNotReceive().ReadBatchAsync(Arg.Any<IEnumerable<string>>(), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a successful read maps the adapter results to tag read outcomes.</summary>
|
||||
[Fact]
|
||||
public void Success_path_maps_results_to_TagReadOutcomes()
|
||||
{
|
||||
@@ -143,6 +147,7 @@ public class DataConnectionManagerReadTagValuesHandlerTests : TestKit
|
||||
Assert.Equal("BadNodeIdUnknown", bOutcome.ErrorMessage);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a cancelled adapter operation is reported as a Timeout outcome.</summary>
|
||||
[Fact]
|
||||
public void Adapter_OperationCancelled_returns_Timeout()
|
||||
{
|
||||
|
||||
+7
-1
@@ -11,7 +11,7 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// Task B5 (T15): the site-side <see cref="DataConnectionManagerActor"/> + child
|
||||
/// The site-side <see cref="DataConnectionManagerActor"/> + child
|
||||
/// <see cref="DataConnectionActor"/> together resolve a
|
||||
/// <see cref="SearchAddressSpaceCommand"/> against the live adapter and surface
|
||||
/// every search outcome as a typed <see cref="BrowseFailure"/> (the search path
|
||||
@@ -29,6 +29,7 @@ public class DataConnectionManagerSearchHandlerTests : TestKit
|
||||
private readonly ISiteHealthCollector _healthCollector;
|
||||
private readonly DataConnectionOptions _options;
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="DataConnectionManagerSearchHandlerTests"/> class.</summary>
|
||||
public DataConnectionManagerSearchHandlerTests()
|
||||
: base(@"akka.loglevel = WARNING")
|
||||
{
|
||||
@@ -41,6 +42,7 @@ public class DataConnectionManagerSearchHandlerTests : TestKit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a search against an unknown connection name returns a ConnectionNotFound failure.</summary>
|
||||
[Fact]
|
||||
public void Unknown_connection_name_returns_ConnectionNotFound()
|
||||
{
|
||||
@@ -59,6 +61,7 @@ public class DataConnectionManagerSearchHandlerTests : TestKit
|
||||
Assert.False(reply.CapReached);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a search against an adapter that cannot search returns a NotBrowsable failure.</summary>
|
||||
[Fact]
|
||||
public void Non_searchable_adapter_returns_NotBrowsable()
|
||||
{
|
||||
@@ -87,6 +90,7 @@ public class DataConnectionManagerSearchHandlerTests : TestKit
|
||||
Assert.Empty(reply.Matches);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a successful search returns the mapped matches.</summary>
|
||||
[Fact]
|
||||
public void Success_path_returns_mapped_matches()
|
||||
{
|
||||
@@ -134,6 +138,7 @@ public class DataConnectionManagerSearchHandlerTests : TestKit
|
||||
Assert.True(reply.CapReached);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the query, depth and result limit are passed through to the adapter.</summary>
|
||||
[Fact]
|
||||
public void Query_depth_and_results_thread_through_to_the_adapter()
|
||||
{
|
||||
@@ -178,6 +183,7 @@ public class DataConnectionManagerSearchHandlerTests : TestKit
|
||||
Assert.Empty(reply.Matches);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a ConnectionNotConnectedException maps to a ConnectionNotConnected failure.</summary>
|
||||
[Fact]
|
||||
public void ConnectionNotConnectedException_maps_to_ConnectionNotConnected()
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// Arch-review 2026-08-19 <b>P2-4</b> (classification half) — how a thrown
|
||||
/// Classification half — how a thrown
|
||||
/// <see cref="ServiceResultException"/> out of a batch subscribe is classified.
|
||||
///
|
||||
/// <para>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// Arch-review 2026-08-19 <b>P2-5</b> — the tag-resolution PROBE path did not seed the tags it
|
||||
/// The tag-resolution PROBE path did not seed the tags it
|
||||
/// resolved.
|
||||
///
|
||||
/// <para>
|
||||
|
||||
+1
@@ -43,6 +43,7 @@ public class DataConnectionReconfigureTests : TestKit
|
||||
private readonly ISiteHealthCollector _healthCollector;
|
||||
private readonly IDataConnectionFactory _factory;
|
||||
|
||||
/// <summary>Initializes a new instance of the <c>DataConnectionReconfigureTests</c> class.</summary>
|
||||
public DataConnectionReconfigureTests()
|
||||
: base(@"akka.loglevel = DEBUG")
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// Arch-review 2026-08-19 <b>P2-1</b> — an in-flight subscribe that completes AFTER the adapter
|
||||
/// An in-flight subscribe that completes AFTER the adapter
|
||||
/// has been swapped out (failover, or the in-place reconfigure of register row 97).
|
||||
///
|
||||
/// <para>
|
||||
|
||||
+2
-2
@@ -10,13 +10,13 @@ using ZB.MOM.WW.ScadaBridge.HealthMonitoring;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// Arch-review 2026-08-19 <b>P2-3</b> — the connect leg of the stale-completion family that
|
||||
/// The connect leg of the stale-completion family that
|
||||
/// <c>DataConnectionStaleCompletionTests</c> pins for the subscribe leg.
|
||||
///
|
||||
/// <para>
|
||||
/// <b>The gap these pin.</b> <c>ConnectResult</c> was piped untagged, so a connect launched
|
||||
/// against adapter generation N and answered after the adapter had been swapped (failover, or the
|
||||
/// row-97 in-place reconfigure) was applied to its REPLACEMENT. A stale success drove
|
||||
/// in-place reconfigure) was applied to its REPLACEMENT. A stale success drove
|
||||
/// <c>ReSubscribeAll</c> and <c>BecomeConnected</c> against an adapter that had never connected;
|
||||
/// the replacement's own result then landed in the Connected state, where nothing handles it. With
|
||||
/// a bad new endpoint the batch subscribes failed at connection level with a log line only, no
|
||||
|
||||
+18
-3
@@ -6,7 +6,7 @@ using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
||||
namespace ZB.MOM.WW.ScadaBridge.DataConnectionLayer.Tests.Actors;
|
||||
|
||||
/// <summary>
|
||||
/// In-memory batch-capable <see cref="IDataConnection"/> for the WP2.1b seam tests. It
|
||||
/// In-memory batch-capable <see cref="IDataConnection"/> for the batch seam tests. It
|
||||
/// records every batch call (so "one round trip per chunk, not per tag" is assertable),
|
||||
/// can fail individual tags or a whole batch, and can hang its bulk read so the seed
|
||||
/// deadline is observable.
|
||||
@@ -55,15 +55,17 @@ public sealed class FakeBatchDataConnection
|
||||
/// <summary>Callback the last alarm subscribe registered.</summary>
|
||||
public AlarmTransitionCallback? AlarmCallback;
|
||||
|
||||
// Fake behaviour: Gets the simulated connection health, which follows connect and disconnect calls.
|
||||
/// <inheritdoc />
|
||||
public ConnectionHealth Status { get; private set; } = ConnectionHealth.Disconnected;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Occurs when the fake raises a simulated transport fault.</summary>
|
||||
public event Action? Disconnected;
|
||||
|
||||
/// <summary>Raises <see cref="Disconnected"/> as a real adapter would on a transport fault.</summary>
|
||||
public void RaiseDisconnected() => Disconnected?.Invoke();
|
||||
|
||||
// Fake behaviour: Marks the fake as connected.
|
||||
/// <inheritdoc />
|
||||
public Task ConnectAsync(IDictionary<string, string> connectionDetails, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -71,6 +73,7 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
// Fake behaviour: Marks the fake as disconnected.
|
||||
/// <inheritdoc />
|
||||
public Task DisconnectAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -78,6 +81,7 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
// Fake behaviour: Records the batch, captures the callback and returns a per-tag result, failing the tags configured to fail.
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyList<TagSubscribeResult>> SubscribeBatchAsync(
|
||||
IReadOnlyList<string> tagPaths, SubscriptionCallback callback, CancellationToken cancellationToken = default)
|
||||
@@ -100,6 +104,7 @@ public sealed class FakeBatchDataConnection
|
||||
return rows;
|
||||
}
|
||||
|
||||
// Fake behaviour: Records the subscription ids passed to the batch unsubscribe.
|
||||
/// <inheritdoc />
|
||||
public Task UnsubscribeBatchAsync(IReadOnlyList<string> subscriptionIds, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -107,6 +112,7 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
// Fake behaviour: Counts the single-tag subscribe call and captures the callback.
|
||||
/// <inheritdoc />
|
||||
public Task<string> SubscribeAsync(string tagPath, SubscriptionCallback callback, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -115,10 +121,12 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.FromResult($"sub-{Interlocked.Increment(ref _nextId)}");
|
||||
}
|
||||
|
||||
// Fake behaviour: Completes without doing anything.
|
||||
/// <inheritdoc />
|
||||
public Task UnsubscribeAsync(string subscriptionId, CancellationToken cancellationToken = default)
|
||||
=> Task.CompletedTask;
|
||||
|
||||
// Fake behaviour: Counts the single-tag read and returns the seed value, or hangs when reads are configured to hang.
|
||||
/// <inheritdoc />
|
||||
public async Task<ReadResult> ReadAsync(string tagPath, CancellationToken cancellationToken = default)
|
||||
{
|
||||
@@ -128,6 +136,7 @@ public sealed class FakeBatchDataConnection
|
||||
return new ReadResult(true, new TagValue(SeedValue, QualityCode.Good, DateTimeOffset.UtcNow), null);
|
||||
}
|
||||
|
||||
// Fake behaviour: Records the batch read and returns the seed value for every tag, or hangs when reads are configured to hang.
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyDictionary<string, ReadResult>> ReadBatchAsync(
|
||||
IEnumerable<string> tagPaths, CancellationToken cancellationToken = default)
|
||||
@@ -142,22 +151,26 @@ public sealed class FakeBatchDataConnection
|
||||
t => new ReadResult(true, new TagValue(SeedValue, QualityCode.Good, DateTimeOffset.UtcNow), null));
|
||||
}
|
||||
|
||||
// Fake behaviour: Reports a successful write without storing anything.
|
||||
/// <inheritdoc />
|
||||
public Task<WriteResult> WriteAsync(string tagPath, object? value, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(new WriteResult(true, null));
|
||||
|
||||
// Fake behaviour: Reports a successful write for every entry without storing anything.
|
||||
/// <inheritdoc />
|
||||
public Task<IReadOnlyDictionary<string, WriteResult>> WriteBatchAsync(
|
||||
IDictionary<string, object?> values, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult<IReadOnlyDictionary<string, WriteResult>>(
|
||||
values.ToDictionary(kv => kv.Key, _ => new WriteResult(true, null)));
|
||||
|
||||
// Fake behaviour: Reports that the handshake matched without writing anything.
|
||||
/// <inheritdoc />
|
||||
public Task<bool> WriteBatchAndWaitAsync(
|
||||
IDictionary<string, object?> values, string flagPath, object? flagValue, string responsePath,
|
||||
object? responseValue, TimeSpan timeout, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(true);
|
||||
|
||||
// Fake behaviour: Captures the alarm callback and returns a generated subscription id.
|
||||
/// <inheritdoc />
|
||||
public Task<string> SubscribeAlarmsAsync(
|
||||
string sourceReference, string? conditionFilter, AlarmTransitionCallback callback,
|
||||
@@ -167,10 +180,12 @@ public sealed class FakeBatchDataConnection
|
||||
return Task.FromResult($"alarm-{Interlocked.Increment(ref _nextId)}");
|
||||
}
|
||||
|
||||
// Fake behaviour: Completes without doing anything.
|
||||
/// <inheritdoc />
|
||||
public Task UnsubscribeAlarmsAsync(string subscriptionId, CancellationToken cancellationToken = default)
|
||||
=> Task.CompletedTask;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Completes immediately because the fake holds no resources.</summary>
|
||||
/// <returns>A completed value task.</returns>
|
||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
+18
@@ -33,6 +33,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
return ExpectMsg<DataConnectionHealthReport>();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a resolution tick does not duplicate an initial subscribe that is already in flight.</summary>
|
||||
[Fact]
|
||||
public void ResolutionTick_DoesNotDuplicateAnInitialSubscribeAlreadyInFlight()
|
||||
{
|
||||
@@ -56,6 +57,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
finally { gate.SetResult(); }
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an in-flight handle still serves a different instance after its original owner dies.</summary>
|
||||
[Fact]
|
||||
public void OriginalOwnerDies_InFlightHandleStillServesDifferentInstance()
|
||||
{
|
||||
@@ -79,6 +81,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.DoesNotContain(adapter.ReceivedCalls(), c => c.GetMethodInfo().Name == "UnsubscribeAsync");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a subscriber terminating during subscribe releases the late handle without resurrecting the subscription.</summary>
|
||||
[Fact]
|
||||
public void SubscriberTermination_DuringSubscribe_ReleasesLateHandleWithoutResurrection()
|
||||
{
|
||||
@@ -97,6 +100,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.Equal(0, Health(actor).ResolvedTags);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a replacement during subscribe adopts only the tags that are still requested.</summary>
|
||||
[Fact]
|
||||
public void Replacement_DuringSubscribe_AdoptsOnlyStillRequestedTags()
|
||||
{
|
||||
@@ -117,6 +121,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.Equal(1, Health(actor).TotalSubscribedTags);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a subscriber terminating during resolution releases the late handle.</summary>
|
||||
[Fact]
|
||||
public void SubscriberTermination_DuringResolution_ReleasesLateHandle()
|
||||
{
|
||||
@@ -139,6 +144,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.Equal(0, Health(actor).ResolvedTags);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that retried subscribes while disconnected keep only the latest request.</summary>
|
||||
[Fact]
|
||||
public void DisconnectedSubscribeRetries_KeepOnlyLatestRequest()
|
||||
{
|
||||
@@ -154,6 +160,8 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.Single(adapter.ReceivedCalls(), c => c.GetMethodInfo().Name == "SubscribeAsync");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that writes while disconnected are rejected and never replayed after reconnect.</summary>
|
||||
/// <param name="reconnect">Whether the connection is re-established after the rejected write.</param>
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
@@ -180,6 +188,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.DoesNotContain(adapter.ReceivedCalls(), c => c.GetMethodInfo().Name is "WriteAsync" or "WriteBatchAsync");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a subscriber terminating releases the handle of its last tag.</summary>
|
||||
[Fact]
|
||||
public void SubscriberTermination_ReleasesLastTagHandle()
|
||||
{
|
||||
@@ -192,6 +201,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
AwaitCondition(() => adapter.ReceivedCalls().Any(c => c.GetMethodInfo().Name == "UnsubscribeAsync" && Equals(c.GetArguments()[0], "handle")), TimeSpan.FromSeconds(1));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an unsubscribe from the old owner does not remove the replacement's tags.</summary>
|
||||
[Fact]
|
||||
public void OldOwnerUnsubscribe_DoesNotRemoveReplacementTags()
|
||||
{
|
||||
@@ -213,6 +223,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.DoesNotContain(adapter.ReceivedCalls(), c => c.GetMethodInfo().Name == "UnsubscribeAsync");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a duplicate completion with a live handle does not unsubscribe it.</summary>
|
||||
[Fact]
|
||||
public void DuplicateCompletion_WithLiveHandle_DoesNotUnsubscribeIt()
|
||||
{
|
||||
@@ -226,6 +237,7 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.DoesNotContain(adapter.ReceivedCalls(), c => c.GetMethodInfo().Name == "UnsubscribeAsync");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a source-scoped snapshot end is not broadcast to other sources.</summary>
|
||||
[Fact]
|
||||
public void SourceScopedSnapshotEnd_IsNotBroadcastToOtherSources()
|
||||
{
|
||||
@@ -244,6 +256,8 @@ public class HighReviewRegressionTests : TestKit
|
||||
b.ExpectMsg<NativeAlarmTransitionUpdate>();
|
||||
a.ExpectNoMsg(TimeSpan.FromMilliseconds(200));
|
||||
}
|
||||
/// <summary>Verifies that a second subscriber receives the standing alarm snapshot.</summary>
|
||||
/// <param name="protocol">The data connection protocol under test.</param>
|
||||
[Theory]
|
||||
[InlineData("OpcUa")]
|
||||
[InlineData("MxGateway")]
|
||||
@@ -281,6 +295,8 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.Contains(received.OfType<NativeAlarmTransitionUpdate>(), m => m.Transition.Kind == AlarmTransitionKind.SnapshotComplete);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a subscriber joining mid-snapshot receives the prefix already seen.</summary>
|
||||
/// <param name="scoped">Whether the snapshot is scoped to a single source.</param>
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
@@ -313,6 +329,8 @@ public class HighReviewRegressionTests : TestKit
|
||||
Assert.Equal(alarm.SnapshotId, end.Transition.SnapshotId);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that replay rejects old-epoch rows and preserves a newer live clear.</summary>
|
||||
/// <param name="staleEpoch">Whether the replayed rows belong to a stale epoch.</param>
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
|
||||
Reference in New Issue
Block a user