test(grpc-data): H2 wire suite; both v1 gates extended with history-shaped data
Both recorded-v1-client gates now run against origins that grant HistoryRead, advertise history capabilities and carry HistoryInfo; header-less bytes stay identical to the goldens (not re-recorded). GrpcDataHistoryWireTests: probe shapes, FAILED_PRECONDITION without the feature, denied/unhistorized/unknown byte-identical with no backend call, admission, cancel, wiring fault, chunking + lost chunk, release, direct runtime consumer. Endpoint allowlist gains HistoryRead (the auth middleware rejected it).
This commit is contained in:
@@ -7,7 +7,7 @@ namespace ZB.MOM.WW.OtOpcUa.Host.Configuration;
|
||||
public static class DataConnectionEndpoints
|
||||
{
|
||||
public const string ServicePrefix = "/data_connection.v1.DataConnectionService/";
|
||||
private static readonly HashSet<string> Methods = ["GetCapabilities", "Browse", "GetMetadata", "Read", "Write", "Subscribe"];
|
||||
private static readonly HashSet<string> Methods = ["GetCapabilities", "Browse", "GetMetadata", "Read", "Write", "Subscribe", "HistoryRead"];
|
||||
|
||||
public static bool IsDataRequest(HttpContext context, DataConnectionOptions options) => options.Enabled
|
||||
&& context.Connection.LocalPort == options.ListenPort
|
||||
|
||||
@@ -122,6 +122,7 @@ public sealed class DataConnectionGrpcService(IDataConnectionFactory factory, IO
|
||||
Execute(context, async (connection, caller, token) =>
|
||||
{
|
||||
var caps = await Ready(connection, DataOperations.Read, token).ConfigureAwait(false);
|
||||
HistoryNegotiated(context, caps); // records the effective set; Read carries no history shape
|
||||
var decoded = DataProtoMapper.DecodeReadRequest(request, DecodeLimits(caps));
|
||||
var results = await connection.ReadAsync(decoded with { Budget = Clamp(decoded.Budget) }, token).ConfigureAwait(false);
|
||||
foreach (var result in results) context.GetHttpContext().Response.RegisterForDispose(result);
|
||||
@@ -138,6 +139,7 @@ public sealed class DataConnectionGrpcService(IDataConnectionFactory factory, IO
|
||||
Execute(context, async (connection, caller, token) =>
|
||||
{
|
||||
var caps = await connection.GetCapabilitiesAsync(DiscoveryBudget, token).ConfigureAwait(false);
|
||||
HistoryNegotiated(context, caps); // records the effective set; Write carries no history shape
|
||||
var limits = DecodeLimits(caps);
|
||||
var decoded = DataProtoMapper.DecodeWriteRequest(request, limits.MaxItems, limits.MaxBytes, limits.MaxValueElements);
|
||||
try
|
||||
@@ -250,6 +252,7 @@ public sealed class DataConnectionGrpcService(IDataConnectionFactory factory, IO
|
||||
initial.CancelAfter(_options.UnaryTimeout);
|
||||
caps = await Ready(connection, DataOperations.Subscribe, initial.Token).ConfigureAwait(false);
|
||||
}
|
||||
HistoryNegotiated(context, caps); // records the effective set; no stream frame carries history in H2
|
||||
var codecHeaders = context.RequestHeaders.Where(entry => string.Equals(entry.Key, DataConnectionProtoContract.CompactCodecHeader, StringComparison.OrdinalIgnoreCase)).ToArray();
|
||||
if (codecHeaders.Length > 1 || codecHeaders.Length == 1 &&
|
||||
(codecHeaders[0].IsBinary || codecHeaders[0].Value != "1"))
|
||||
|
||||
Reference in New Issue
Block a user