Auto: opcuaclient-1 — per-subscription tuning

Closes #273
This commit is contained in:
Joseph Doherty
2026-04-25 15:09:08 -04:00
parent 8314c273e7
commit 7209364c35
3 changed files with 105 additions and 13 deletions

View File

@@ -67,6 +67,45 @@ public sealed class OpcUaClientDriverScaffoldTests
health.LastError.ShouldNotBeNull();
}
[Fact]
public void Default_subscription_tuning_matches_prior_hard_coded_values()
{
// PR #273: lifted hard-coded Subscription parameters into options; defaults MUST
// remain wire-identical so existing deployments see no behaviour change.
var subs = new OpcUaClientDriverOptions().Subscriptions;
subs.KeepAliveCount.ShouldBe(10);
subs.LifetimeCount.ShouldBe(1000u);
subs.MaxNotificationsPerPublish.ShouldBe(0u, "0 = unlimited per OPC UA spec");
subs.Priority.ShouldBe((byte)0);
subs.MinPublishingIntervalMs.ShouldBe(50);
subs.AlarmsPriority.ShouldBe((byte)1, "alarms get a higher priority than data tags so they aren't starved during bursts");
}
[Fact]
public void Subscription_defaults_are_overridable_via_options()
{
// Operators tuning a flaky-network deployment should be able to bump LifetimeCount /
// lower MaxNotificationsPerPublish without recompiling the driver. Verify the record
// is overridable end-to-end.
var opts = new OpcUaClientDriverOptions
{
Subscriptions = new OpcUaSubscriptionDefaults(
KeepAliveCount: 25,
LifetimeCount: 5000u,
MaxNotificationsPerPublish: 200u,
Priority: 7,
MinPublishingIntervalMs: 100,
AlarmsPriority: 9),
};
opts.Subscriptions.KeepAliveCount.ShouldBe(25);
opts.Subscriptions.LifetimeCount.ShouldBe(5000u);
opts.Subscriptions.MaxNotificationsPerPublish.ShouldBe(200u);
opts.Subscriptions.Priority.ShouldBe((byte)7);
opts.Subscriptions.MinPublishingIntervalMs.ShouldBe(100);
opts.Subscriptions.AlarmsPriority.ShouldBe((byte)9);
}
[Fact]
public async Task Reinitialize_against_unreachable_endpoint_re_throws()
{