test(grpc-data): H2 manifest key and artifact projection of the history fields

This commit is contained in:
Joseph Doherty
2026-11-23 21:02:04 -05:00
parent 6fd4c2b0b5
commit 9b5bb29619
2 changed files with 101 additions and 0 deletions
@@ -273,6 +273,38 @@ public sealed class GrpcDataArtifactReadTests
(DataOperationSets.Understood & (DataOperations)1073741824).ShouldBe(DataOperations.None, "the bit is never granted");
}
[Fact]
[Trait("Phase", "H2")]
public void History_fields_project_through_the_artifact_and_a_pre_H2_artifact_gets_the_defaults()
{
// A pre-H2 central's artifact has no history fields: the rows parse with the plan's defaults.
using (var old = DeploymentArtifact.Open(Blob(Fixture())))
{
old.ParseDataConnections(NodeA).ShouldHaveSingleItem().HistoryTimeoutMilliseconds.ShouldBe(30000);
var export = old.ParseDataExports(NodeA).ShouldHaveSingleItem();
(export.MaxConcurrentHistoryReads, export.MaxHistoryValuesPerPage, export.MaxHistoryResponseBytes).ShouldBe((4, 10000, 4 * 1024 * 1024));
old.ParseRemoteNamespaceMappings(NodeA).ShouldHaveSingleItem().MaxHistoryAssemblyBytesPerRequest.ShouldBe(16 * 1024 * 1024);
}
var root = Fixture();
root["DataConnections"]![0]!["HistoryTimeoutMilliseconds"] = 1234;
root["DataConnections"]![0]!["AllowedOperations"] = (int)(DataOperations.Browse | DataOperations.Read | DataOperations.HistoryRead);
root["DataExports"]![0]!["MaxConcurrentHistoryReads"] = 2;
root["DataExports"]![0]!["MaxHistoryValuesPerPage"] = 50;
root["DataExports"]![0]!["MaxHistoryResponseBytes"] = 65536;
root["RemoteNamespaceMappings"]![0]!["MaxHistoryAssemblyBytesPerRequest"] = 1 << 20;
using var parsed = DeploymentArtifact.Open(Blob(root));
var connection = parsed.ParseDataConnections(NodeA).ShouldHaveSingleItem();
connection.HistoryTimeoutMilliseconds.ShouldBe(1234);
(connection.AllowedOperations & DataOperationSets.Understood).HasFlag(DataOperations.HistoryRead).ShouldBeTrue("understood since H2");
var exported = parsed.ParseDataExports(NodeA).ShouldHaveSingleItem();
(exported.MaxConcurrentHistoryReads, exported.MaxHistoryValuesPerPage, exported.MaxHistoryResponseBytes).ShouldBe((2, 50, 65536));
parsed.ParseRemoteNamespaceMappings(NodeA).ShouldHaveSingleItem().MaxHistoryAssemblyBytesPerRequest.ShouldBe(1 << 20);
// A non-positive history limit on a deployed row is rejected node-side like every other limit.
root["DataExports"]![0]!["MaxHistoryValuesPerPage"] = 0;
using var bad = DeploymentArtifact.Open(Blob(root));
Should.Throw<InvalidDataException>(() => bad.ParseDataExports(NodeA));
}
[Fact]
public void Missing_connection_array_does_not_leave_an_enabled_orphan_mount()
{