test(grpc-data): A1 — real-driver signal rig (StartRig over IDriver), FOCAS end-to-end; driver test classes in the A1 manifest

This commit is contained in:
Joseph Doherty
2026-11-24 10:25:47 -05:00
parent 9167ea2323
commit 141e4412d2
3 changed files with 221 additions and 4 deletions
@@ -55,10 +55,30 @@ public abstract class NativeAlarmSignalTestBase : RuntimeActorTestBase
/// <returns>The rig.</returns>
protected Rig StartRig(string driverType, IReadOnlyList<string> alarmTags,
Func<ConditionSignalOptions, ConditionSignalOptions>? configure = null, FakeSignallingAlarmDriver? driver = null)
{
driver ??= new FakeSignallingAlarmDriver(DriverId, driverType);
var fake = driver;
var (host, publish, hub) = StartRig(driver, driverType, alarmTags, configure, () => fake.Subscribed);
return new Rig(host, publish, driver, hub);
}
/// <summary>
/// The same rig over ANY <see cref="IDriver"/> (a REAL driver over a fake device): deploys
/// <paramref name="alarmTags"/> on it and waits for the apply, then for <paramref name="ready"/> (e.g. the real
/// driver's alarm subscription) when given.
/// </summary>
/// <param name="driver">The driver the host spawns (its <see cref="IDriver.DriverInstanceId"/> must be <see cref="DriverId"/>).</param>
/// <param name="driverType">The driver type.</param>
/// <param name="alarmTags">The alarm tag names (RawPaths per <see cref="RawPathOf"/>).</param>
/// <param name="configure">Adjusts the signal options (timeouts).</param>
/// <param name="ready">Optional readiness predicate awaited after the apply.</param>
/// <returns>The host, the publish probe and the hub.</returns>
protected (IActorRef Host, TestProbe Publish, ConditionStateHub Hub) StartRig(IDriver driver, string driverType,
IReadOnlyList<string> alarmTags, Func<ConditionSignalOptions, ConditionSignalOptions>? configure = null,
Func<bool>? ready = null)
{
var db = NewInMemoryDbFactory();
var deploymentId = Seed(db, driverType, alarmTags);
driver ??= new FakeSignallingAlarmDriver(DriverId, driverType);
var hub = new ConditionStateHub();
var options = new ConditionSignalOptions { Hub = hub };
options = configure?.Invoke(options) ?? options;
@@ -77,8 +97,8 @@ public abstract class NativeAlarmSignalTestBase : RuntimeActorTestBase
host.Tell(new DispatchDeployment(deploymentId, Rev, CorrelationId.NewId()));
coordinator.FishForMessage<ApplyAck>(_ => true, TimeSpan.FromSeconds(10), cancellationToken: TestContext.Current.CancellationToken).Outcome.ShouldBe(ApplyAckOutcome.Applied);
AwaitCondition(() => driver.Subscribed, TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken);
return new Rig(host, publish, driver, hub);
if (ready is not null) AwaitCondition(ready, TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken);
return (host, publish, hub);
}
/// <summary>Negative control: for <paramref name="duration"/>, the probe receives no