test(r2-06): pin 0.2.0 Boolean->Int1 explicit-presence (HasDataType) provisioning (06/U-7)
This commit is contained in:
@@ -51,7 +51,7 @@
|
|||||||
{
|
{
|
||||||
"id": "T7",
|
"id": "T7",
|
||||||
"subject": "U-7 pin: GatewayTagProvisionerTests Boolean_definition_carries_explicit_Int1_presence (asserts HistorianDataType.Int1 AND HasDataType — 0.2.0 proto3-optional presence witness; pin, no RED phase)",
|
"subject": "U-7 pin: GatewayTagProvisionerTests Boolean_definition_carries_explicit_Int1_presence (asserts HistorianDataType.Int1 AND HasDataType — 0.2.0 proto3-optional presence witness; pin, no RED phase)",
|
||||||
"status": "pending",
|
"status": "completed",
|
||||||
"blockedBy": []
|
"blockedBy": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+29
@@ -31,6 +31,35 @@ public sealed class GatewayTagProvisionerTests
|
|||||||
Assert.Equal(0, result.Skipped);
|
Assert.Equal(0, result.Skipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// archreview 06/U-7 — pins the 0.2.0 Boolean→Int1 provisioning semantics at TWO levels. The
|
||||||
|
/// 0.1.0→0.2.0 client bump made <c>HistorianTagDefinition.DataType</c> proto3-optional (explicit
|
||||||
|
/// presence): under 0.1.0 the provisioner's <c>Int1</c> (wire 0) was indistinguishable from unset,
|
||||||
|
/// so the gateway defaulted Boolean tags to Float; under 0.2.0 the same call carries explicit
|
||||||
|
/// presence and provisions Int1 (the intended behavior). Asserting BOTH the mapped type AND
|
||||||
|
/// <c>HasDataType</c> compile-pins the package floor (the <c>HasDataType</c>/<c>ClearDataType</c>
|
||||||
|
/// members exist only on the 0.2.0 proto3-optional contract — a downgrade breaks the build) and
|
||||||
|
/// assert-pins that the provisioner always sends explicit presence (a future contract change that
|
||||||
|
/// stopped sending it would break the assert). This is a pin, not a fix — it passes on current code.
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public async Task Boolean_definition_carries_explicit_Int1_presence()
|
||||||
|
{
|
||||||
|
var fake = new FakeHistorianGatewayClient { EnsureTagsResult = new TagOperationResults() };
|
||||||
|
var p = Provisioner(fake);
|
||||||
|
|
||||||
|
await p.EnsureTagsAsync(
|
||||||
|
new[] { new HistorianTagProvisionRequest("Pump1.Run", DriverDataType.Boolean, null, null) },
|
||||||
|
TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
|
var defs = fake.LastEnsureDefinitions!;
|
||||||
|
Assert.Single(defs);
|
||||||
|
Assert.Equal(HistorianDataType.Int1, defs[0].DataType);
|
||||||
|
// 0.2.0 proto3-optional presence witness — explicit presence is what flips the gateway from its
|
||||||
|
// SDK-default Float to the requested Int1. Without this, a Boolean tag would provision as Float.
|
||||||
|
Assert.True(defs[0].HasDataType);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Maps_metadata_and_coalesces_null_metadata_to_empty()
|
public async Task Maps_metadata_and_coalesces_null_metadata_to_empty()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user