test: shared actor test bases poll AwaitCondition every 20 ms, not max/10 (lmxopcua#775)
v2-ci / unit-tests (push) Has been cancelled

Akka TestKit's AwaitCondition without an interval polls every max/10 of the
DILATED budget. Measured here: a condition that turned true at 2 s under a
15 s budget returned after 3003 ms at timefactor 1 (3 polls) and 4502 ms at
timefactor 3 (2 polls). AwaitAssert / AwaitAssertAsync are unaffected (a
fixed 100 ms: 21 polls in ~2 s at both factors).

RuntimeActorTestBase and ControlPlaneActorTestBase now declare
AwaitCondition overloads that hide TestKit's and default the interval to
PollInterval (20 ms), so every subclass call without an interval binds to
them (measured after: returns 5-22 ms after the condition holds, at both
factors). PresenceBudget's doc no longer claims the helpers return "the
instant the condition holds" - it states the per-helper poll behaviour.

Bare-TestKit classes with AwaitCondition calls get an explicit interval:
TelemetryDialDeadlineTests / TelemetryDialSupervisorTests (next to their own
undilated 5 s / 8 s WaitForCount deadlines and a 1 s dial deadline) and
OpcUaEndpointStepDownActorTests (RuntimeActorTestBase.PollInterval, now
public like PresenceBudget). ContinuousHistorizationRecorderTypedValueTests'
AwaitConditionAsync was left alone (historian code is being changed in
parallel).

Suite results (Release, 0 warnings):
- Runtime.Tests 946/3 skipped/0 failed at timefactor 3 (1 m 45 s, was
  2 m 57 s) and 1 (1 m 18 s, was 2 m 57 s);
- ControlPlane.Tests 319/0 failed at 3 (1 m 51 s) and 1 (1 m 11 s);
- AdminUI.Tests Telemetry 15/0 failed at 3 and 1.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 15:28:58 -05:00
parent 75be6fe12b
commit c86c7cbf35
5 changed files with 97 additions and 11 deletions
@@ -56,11 +56,13 @@ akka {
_nodeA = new TestKit(Hocon + TestTimeFactor.Hocon);
var clusterA = Akka.Cluster.Cluster.Get(_nodeA.Sys);
clusterA.Join(clusterA.SelfAddress);
AwaitCondition(() => UpCount(clusterA) == 1, RuntimeActorTestBase.PresenceBudget);
AwaitCondition(() => UpCount(clusterA) == 1, RuntimeActorTestBase.PresenceBudget,
RuntimeActorTestBase.PollInterval);
var clusterB = Akka.Cluster.Cluster.Get(Sys);
clusterB.Join(clusterA.SelfAddress);
AwaitCondition(() => UpCount(clusterA) == 2 && UpCount(clusterB) == 2, RuntimeActorTestBase.PresenceBudget);
AwaitCondition(() => UpCount(clusterA) == 2 && UpCount(clusterB) == 2, RuntimeActorTestBase.PresenceBudget,
RuntimeActorTestBase.PollInterval);
// Fixture sanity: A must be the Primary going in, or every assertion below is about the wrong node.
ClusterActiveNode.SelfIsActive(clusterA, RoleParser.Driver).ShouldBeTrue("node A formed the cluster, so it is the oldest Up driver member");
@@ -100,7 +102,7 @@ akka {
var clusterB = Akka.Cluster.Cluster.Get(Sys);
AwaitCondition(() => ClusterActiveNode.SelfIsActive(clusterB, RoleParser.Driver)
&& clusterB.State.Members.Count(m => m.Status == MemberStatus.Up) == 1,
RuntimeActorTestBase.PresenceBudget);
RuntimeActorTestBase.PresenceBudget, RuntimeActorTestBase.PollInterval);
}
/// <summary>A failed endpoint on the SECONDARY changes nothing: there is no role to hand over.</summary>