fix(heidenhain): resolve the probe's secret resolver lazily — eager resolution crash-looped central nodes at boot (#803)
v2-ci / unit-tests (push) Successful in 1h9m7s
v2-ci / unit-tests (push) Successful in 1h9m7s
The Test-Connect probe set is resolved inside the AdminOperations Akka starter; resolving ISecretResolver there walks AddZbSecrets -> IAuditWriter -> ActorAuditWriter, whose ctor needs AuditWriterActorKey (registered later in the same builder). Found by the docker-dev live gate. Regression test: resolving the probe set never resolves ISecretResolver (fails before the fix). Also: TagRowProblem doc comment re-attached; Heidenhain credential help text names the secret:heidenhain/ and env:OTOPCUA_HEIDENHAIN_ namespaces.
This commit is contained in:
@@ -102,4 +102,27 @@ public sealed class DriverProbeRegistrationTests
|
||||
probes.Count.ShouldBe(distinctTypes, "Duplicate IDriverProbe registrations — TryAddEnumerable should de-dup.");
|
||||
distinctTypes.ShouldBe(DriverTypeNames.All.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Resolving_the_probe_set_never_resolves_the_secret_resolver()
|
||||
{
|
||||
// #803 live gate: the probe set is resolved inside the AdminOperations Akka starter, where
|
||||
// ISecretResolver -> AddZbSecrets -> IAuditWriter -> ActorAuditWriter throws (its actor key is
|
||||
// registered later in the same builder). A probe that resolved the secret resolver eagerly crash-looped
|
||||
// every central node at boot. Model that starter-time graph with a resolver factory that throws.
|
||||
var resolved = 0;
|
||||
var services = new ServiceCollection();
|
||||
services.AddSingleton<ZB.MOM.WW.Secrets.Abstractions.ISecretResolver>(_ =>
|
||||
{
|
||||
resolved++;
|
||||
throw new InvalidOperationException("ISecretResolver must not be resolved while building the probe set");
|
||||
});
|
||||
services.AddOtOpcUaDriverProbes();
|
||||
|
||||
using var sp = services.BuildServiceProvider();
|
||||
var probes = sp.GetServices<IDriverProbe>().ToList();
|
||||
|
||||
probes.ShouldNotBeEmpty();
|
||||
resolved.ShouldBe(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user