test(windev): fix the two Windows-only gateway test failures dismissed as environmental
Both failures in the windev baseline were test bugs that reproduce on any Windows host, not anything missing or misconfigured on windev. SelfSignedCertificateProviderTests.GenerateCertificate_HasExpectedSansEkuAndValidity asserted SAN content by substring-matching X509Extension.Format(false). That string comes from the platform crypto library: Windows' CryptFormatObject renders the IPv6 loopback fully expanded (0000:0000:...:0001) where the managed formatter renders "::1", so the loopback assertion could never hold on Windows. Decode the extension with X509SubjectAlternativeNameExtension and compare parsed IPAddress values and DNS names instead, which removes the platform-dependent formatting from the assertion. SessionManagerTests.OpenSessionAsync_PipeNameIsShortAndUniquePerPidAndSession guards the 104-byte macOS sun_path budget NEXT-01 shortened the pipe name to fit. It padded the measured name up to a five-digit pid but never substituted that worst case downward, so Windows' routine six-digit pids over-counted by a character against a budget that does not constrain the host running the test. Substitute the five-digit macOS worst case for the running pid's digit count so the check measures the name format rather than the current pid. EventStreamServiceTests.WaitUntilAsync now reports the unmet condition on timeout instead of letting a bare TaskCanceledException escape. Its five-second real-clock deadline is genuinely load-sensitive on windev (36 logical CPUs, maxParallelThreads -1), and an opaque cancellation there is exactly what got the previous failures filed as "environmental" and left unexplained. Documents the windev run in docs/GatewayTesting.md: the two fixed bugs and their root causes, the real-pipe suites whose failures are evidence of machine load rather than of the change under test, and the full-suite testhost that completes every test and then never exits (filtered runs exit normally; macOS exits cleanly). Corrects the CLAUDE.md claim that the suite exits cleanly on the Windows dev box.
This commit is contained in:
@@ -61,10 +61,20 @@ public sealed class SessionManagerTests
|
||||
|
||||
// 104-byte sun_path − NUL − ~49-char default macOS TMPDIR − "CoreFxPipe_".
|
||||
const int MaxPipeNameLength = 104 - 1 - 49 - 11;
|
||||
int worstCasePidDigits = 5 - Environment.ProcessId.ToString(System.Globalization.CultureInfo.InvariantCulture).Length;
|
||||
|
||||
// macOS pids top out at 99999, so 5 digits is the worst case the budget must survive.
|
||||
// The check must substitute that worst case for the *running* pid's digit count rather
|
||||
// than pad the measured length upward: Windows pids are routinely 6 digits, which would
|
||||
// otherwise fail this assertion on a host whose own pipe-name limit (256) is irrelevant
|
||||
// to the macOS budget being guarded here.
|
||||
const int WorstCaseMacOsPidDigits = 5;
|
||||
int runningPidDigits = Environment.ProcessId
|
||||
.ToString(System.Globalization.CultureInfo.InvariantCulture).Length;
|
||||
int worstCaseLength = session.PipeName.Length - runningPidDigits + WorstCaseMacOsPidDigits;
|
||||
Assert.True(
|
||||
session.PipeName.Length + Math.Max(0, worstCasePidDigits) <= MaxPipeNameLength,
|
||||
$"Pipe name '{session.PipeName}' would overflow the macOS socket-path budget at a 5-digit pid.");
|
||||
worstCaseLength <= MaxPipeNameLength,
|
||||
$"Pipe name '{session.PipeName}' would overflow the macOS socket-path budget at a 5-digit pid " +
|
||||
$"({worstCaseLength} > {MaxPipeNameLength}).");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a session opened by an authenticated caller records that caller's API key id in OwnerKeyId.</summary>
|
||||
|
||||
Reference in New Issue
Block a user