feat(hosts): driver diagnostics channel on /hosts, S7 negotiated PDU size first (#640)
Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
+37
@@ -276,6 +276,43 @@ public sealed class TelemetryProtoMapCentralTests
|
||||
TelemetryProtoMapCentral.ToHealth(absentSkips).SkippedTags.ShouldBeNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #640: the diagnostics bag round-trips with the null vs empty distinction intact, and a pre-#640
|
||||
/// node (field never set) decodes to null.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ToHealth_diagnostics_round_trip_with_the_null_vs_empty_distinction_intact()
|
||||
{
|
||||
var populated = new DriverHealth
|
||||
{
|
||||
ClusterId = "c1", DriverInstanceId = "d1", State = "Healthy",
|
||||
PublishedUtc = Timestamp.FromDateTime(SampleUtc),
|
||||
HasDiagnostics = true,
|
||||
Diagnostics = { ["S7.NegotiatedPduSize"] = "480", ["Other"] = "x" },
|
||||
};
|
||||
var mapped = TelemetryProtoMapCentral.ToHealth(populated).Diagnostics;
|
||||
mapped.ShouldNotBeNull();
|
||||
mapped!.Count.ShouldBe(2);
|
||||
mapped["S7.NegotiatedPduSize"].ShouldBe("480");
|
||||
|
||||
var empty = new DriverHealth
|
||||
{
|
||||
ClusterId = "c1", DriverInstanceId = "d1", State = "Healthy",
|
||||
PublishedUtc = Timestamp.FromDateTime(SampleUtc),
|
||||
HasDiagnostics = true,
|
||||
};
|
||||
var mappedEmpty = TelemetryProtoMapCentral.ToHealth(empty).Diagnostics;
|
||||
mappedEmpty.ShouldNotBeNull();
|
||||
mappedEmpty!.ShouldBeEmpty();
|
||||
|
||||
var absent = new DriverHealth
|
||||
{
|
||||
ClusterId = "c1", DriverInstanceId = "d1", State = "Healthy",
|
||||
PublishedUtc = Timestamp.FromDateTime(SampleUtc),
|
||||
};
|
||||
TelemetryProtoMapCentral.ToHealth(absent).Diagnostics.ShouldBeNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An unparseable host state degrades to <see cref="HostState.Unknown"/> rather than throwing. A node
|
||||
/// running a newer build that added an enum member must not be able to kill central's telemetry
|
||||
|
||||
Reference in New Issue
Block a user