fix(r2-10): register the tracker's production reader on driver nodes + wiring guard

This commit is contained in:
Joseph Doherty
2026-07-13 10:42:18 -04:00
parent 37f180c5a3
commit 12b2ce078b
3 changed files with 38 additions and 1 deletions
@@ -0,0 +1,30 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.Host.Drivers;
namespace ZB.MOM.WW.OtOpcUa.Host.IntegrationTests;
/// <summary>
/// Guards that the resilience-status tracker now HAS a production reader — the exact
/// "built-but-never-wired" class of bug the whole arch-review targets (mirrors
/// <see cref="ResilienceInvokerFactoryRegistrationTests"/>). <c>AddOtOpcUaDriverFactories</c> (the
/// driver-node bootstrap) must register <see cref="DriverResilienceStatusPublisherService"/> as an
/// <see cref="IHostedService"/>. A refactor that drops the registration fails this test, not production.
/// </summary>
public sealed class ResilienceStatusReaderRegistrationTests
{
[Fact]
public void AddOtOpcUaDriverFactories_registers_the_resilience_status_reader_hosted_service()
{
var services = new ServiceCollection();
services.AddLogging();
services.AddOtOpcUaDriverFactories();
services.ShouldContain(
d => d.ServiceType == typeof(IHostedService)
&& d.ImplementationType == typeof(DriverResilienceStatusPublisherService),
"the resilience-status tracker must have a production reader — the periodic DPS publisher hosted service on driver nodes");
}
}