test(e2e): harden CliRunner timeout drain + skip-counter (review fixes)

This commit is contained in:
Joseph Doherty
2026-06-05 09:59:41 -04:00
parent 9e914299c8
commit bf78e3e7bf
2 changed files with 6 additions and 3 deletions
@@ -41,7 +41,7 @@ public static class CliRunner
private const string CliPassword = "password";
private static readonly object DllLock = new();
private static string? _cliDll;
private static volatile string? _cliDll;
/// <summary>
/// Management URL the CLI connects to (via the Traefik load balancer).
@@ -111,6 +111,9 @@ public static class CliRunner
catch (OperationCanceledException)
{
TryKill(process);
// Drain both pipes so the abandoned read tasks complete cleanly before disposal.
try { await Task.WhenAll(stdoutTask, stderrTask).WaitAsync(TimeSpan.FromSeconds(5)); }
catch { /* best-effort — we are already throwing TimeoutException */ }
throw new TimeoutException(
$"CLI [{string.Join(' ', args)}] did not exit within {Timeout.TotalSeconds:F0}s and was killed.");
}
@@ -32,7 +32,7 @@ public static class ClusterAvailability
{
if (!cached)
{
SkippedCount++;
System.Threading.Interlocked.Increment(ref SkippedCount);
}
return cached;
@@ -46,7 +46,7 @@ public static class ClusterAvailability
catch
{
_cached = false;
SkippedCount++;
System.Threading.Interlocked.Increment(ref SkippedCount);
}
return _cached.Value;