fix(hosts): a driver that never built a tag table reports NO ANSWER, not zero skips
Found on the docker-dev live gate, not in tests. Two drivers that faulted during initialise (rtu-gate, opcua1) each rendered "0 tags" on /hosts against two authored tags apiece, because a ledger that had never committed returned SkippedTagReport.Empty. A zero report is a positive claim -- "this driver skipped nothing" -- and making it on behalf of a driver that never got as far as looking is exactly the quiet inaccuracy #541 exists to remove. GetSkippedTags() and SkippedTagLedger.Snapshot() now return null until the first committed build, so the column renders the same em-dash it already used for a driver that cannot report at all. Both are 'no answer'; neither is 'nothing skipped'. Knock-on: a FOCAS driver whose only init threw now reports null rather than a zero report, which is strictly more honest than the assertion the test originally made.
This commit is contained in:
+10
-8
@@ -42,7 +42,7 @@ public sealed class FocasSkippedTagReportingTests
|
||||
|
||||
await drv.InitializeAsync("{}", CancellationToken.None);
|
||||
|
||||
var report = drv.GetSkippedTags();
|
||||
var report = drv.GetSkippedTags()!;
|
||||
report.AuthoredCount.ShouldBe(2);
|
||||
report.SkippedCount.ShouldBe(0);
|
||||
report.HasSkips.ShouldBeFalse();
|
||||
@@ -75,7 +75,7 @@ public sealed class FocasSkippedTagReportingTests
|
||||
drv.GetHealth().LastError.ShouldBeNull();
|
||||
|
||||
// …and the fact that contradicts it.
|
||||
var report = drv.GetSkippedTags();
|
||||
var report = drv.GetSkippedTags()!;
|
||||
report.AuthoredCount.ShouldBe(22);
|
||||
report.SkippedCount.ShouldBe(20);
|
||||
report.SkippedEverything.ShouldBeFalse("two tags do poll — this driver is partly working");
|
||||
@@ -97,7 +97,7 @@ public sealed class FocasSkippedTagReportingTests
|
||||
|
||||
await drv.InitializeAsync("{}", CancellationToken.None);
|
||||
|
||||
var report = drv.GetSkippedTags();
|
||||
var report = drv.GetSkippedTags()!;
|
||||
report.SkippedCount.ShouldBe(25);
|
||||
report.Sample.Count.ShouldBe(SkippedTagLedger.MaxSample);
|
||||
report.SkippedEverything.ShouldBeTrue("this driver polls nothing at all");
|
||||
@@ -116,11 +116,11 @@ public sealed class FocasSkippedTagReportingTests
|
||||
new FocasTagDefinition("raw/Good", Host, "MACRO:500", FocasDataType.Float64));
|
||||
|
||||
await drv.InitializeAsync("{}", CancellationToken.None);
|
||||
drv.GetSkippedTags().SkippedCount.ShouldBe(1);
|
||||
drv.GetSkippedTags()!.SkippedCount.ShouldBe(1);
|
||||
|
||||
await drv.InitializeAsync("{}", CancellationToken.None);
|
||||
|
||||
var report = drv.GetSkippedTags();
|
||||
var report = drv.GetSkippedTags()!;
|
||||
report.SkippedCount.ShouldBe(1, "the same one bad tag — not two");
|
||||
report.AuthoredCount.ShouldBe(2);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public sealed class FocasSkippedTagReportingTests
|
||||
};
|
||||
var drv = new FocasDriver(good, "drv-1", new FakeFocasClientFactory());
|
||||
await drv.InitializeAsync("{}", CancellationToken.None);
|
||||
drv.GetSkippedTags().Sample.Single().RawPath.ShouldBe("raw/Bad");
|
||||
drv.GetSkippedTags()!.Sample.Single().RawPath.ShouldBe("raw/Bad");
|
||||
|
||||
// A second driver over an artifact whose tag names a device that is not configured: the loop skips
|
||||
// the first entry, then throws on the second.
|
||||
@@ -164,7 +164,9 @@ public sealed class FocasSkippedTagReportingTests
|
||||
await Should.ThrowAsync<InvalidOperationException>(
|
||||
() => drv2.InitializeAsync("{}", CancellationToken.None));
|
||||
|
||||
drv2.GetSkippedTags().SkippedCount.ShouldBe(0,
|
||||
"an abandoned build must not publish; a partial report would read as 'we skip fewer tags now'");
|
||||
// NO ANSWER, not "zero skipped": this driver's only build threw, so it never reached a verdict.
|
||||
// A zero report here would be the same false reassurance the docker-dev rig showed for two
|
||||
// faulted drivers, and a PARTIAL one would read as "we skip fewer tags now".
|
||||
drv2.GetSkippedTags().ShouldBeNull();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user