fix(grpc): configure Kestrel HTTP/2 keepalive (60 s ping, 10 s timeout) under MxGateway:Protocol (SES-005, #253)

This commit is contained in:
Joseph Doherty
2026-12-03 10:03:53 -05:00
parent 87b8f8da09
commit a474d3219b
8 changed files with 259 additions and 4 deletions
@@ -1330,6 +1330,35 @@ public sealed class GatewayOptionsValidatorTests
Assert.True(result.Succeeded);
}
/// <summary>SES-005: the HTTP/2 keepalive knobs are range-checked; a delay of 0 (off) is valid.</summary>
/// <param name="delaySeconds">Configured ping delay.</param>
/// <param name="timeoutSeconds">Configured ping timeout.</param>
/// <param name="valid">Whether validation should pass.</param>
[Theory]
[InlineData(60, 10, true)]
[InlineData(0, 10, true)]
[InlineData(86400, 3600, true)]
[InlineData(-1, 10, false)]
[InlineData(86401, 10, false)]
[InlineData(60, 0, false)]
[InlineData(60, 3601, false)]
public void Validate_Http2KeepAlive_IsRangeChecked(int delaySeconds, int timeoutSeconds, bool valid)
{
GatewayOptions options = WithWorkerAndProtocol(
new WorkerOptions(),
new ProtocolOptions
{
Http2KeepAlivePingDelaySeconds = delaySeconds,
Http2KeepAlivePingTimeoutSeconds = timeoutSeconds,
});
ValidateOptionsResult result = new GatewayOptionsValidator().Validate(null, options);
bool keepAliveFailure = result.Failed
&& result.Failures!.Any(f => f.Contains("Http2KeepAlive", StringComparison.Ordinal));
Assert.Equal(!valid, keepAliveFailure);
}
/// <summary>
/// Verifies that a worker-frame maximum equal to the gRPC cap (zero headroom) fails validation:
/// a maximally-sized accepted gRPC payload would not fit one worker frame once wrapped in a