fix(delmia,inbound): a connect-phase failure (unreachable host, connect timeout) fails over to the next URL/peer instead of OUTCOME_UNKNOWN (DLM-1, WP4 task 4.7)

This commit is contained in:
Joseph Doherty
2026-12-03 10:01:59 -05:00
parent 11992075e8
commit c15bd210f7
11 changed files with 317 additions and 20 deletions
@@ -297,6 +297,33 @@ public class StandbyRequestForwardingTests
AssertStatus(result, StatusCodes.Status503ServiceUnavailable);
}
/// <summary>
/// DLM-1 regression: a powered-off / black-holed peer (TEST-NET-1 never answers the SYN) is a
/// not-dispatched connect failure with the production handler — the relay moves on and, with
/// every peer unreachable, answers 503 ACTIVE_NODE_UNREACHABLE instead of a 60 s wait ending
/// in 502 OUTCOME_UNKNOWN.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task Forwarder_BlackHoledPeer_IsNotDispatched_TriesNextPeer()
{
using var handler = RelayConnectPhase.CreateHandler(TimeSpan.FromMilliseconds(500));
var forwarder = new HttpStandbyRequestForwarder(
new FakeHttpClientFactory(handler),
new StaticOptionsMonitor<InboundApiOptions>(new InboundApiOptions
{
StandbyForwardPeerEndpoints = ["http://192.0.2.1:5000", "http://127.0.0.1:1"],
StandbyForwardTimeout = TimeSpan.FromSeconds(20),
}),
NullLogger<HttpStandbyRequestForwarder>.Instance);
var sw = System.Diagnostics.Stopwatch.StartNew();
var result = await forwarder.ForwardAsync(BuildRequestContext("{}"), CancellationToken.None);
AssertStatus(result, StatusCodes.Status503ServiceUnavailable);
Assert.True(sw.Elapsed < TimeSpan.FromSeconds(15), $"took {sw.Elapsed}");
}
/// <summary>Verifies that a peer timeout returns an uncertain result without trying the next peer.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]