test(e2e): harden CliRunner timeout drain + skip-counter (review fixes)
This commit is contained in:
@@ -41,7 +41,7 @@ public static class CliRunner
|
|||||||
private const string CliPassword = "password";
|
private const string CliPassword = "password";
|
||||||
|
|
||||||
private static readonly object DllLock = new();
|
private static readonly object DllLock = new();
|
||||||
private static string? _cliDll;
|
private static volatile string? _cliDll;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Management URL the CLI connects to (via the Traefik load balancer).
|
/// Management URL the CLI connects to (via the Traefik load balancer).
|
||||||
@@ -111,6 +111,9 @@ public static class CliRunner
|
|||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
TryKill(process);
|
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(
|
throw new TimeoutException(
|
||||||
$"CLI [{string.Join(' ', args)}] did not exit within {Timeout.TotalSeconds:F0}s and was killed.");
|
$"CLI [{string.Join(' ', args)}] did not exit within {Timeout.TotalSeconds:F0}s and was killed.");
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -32,7 +32,7 @@ public static class ClusterAvailability
|
|||||||
{
|
{
|
||||||
if (!cached)
|
if (!cached)
|
||||||
{
|
{
|
||||||
SkippedCount++;
|
System.Threading.Interlocked.Increment(ref SkippedCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cached;
|
return cached;
|
||||||
@@ -46,7 +46,7 @@ public static class ClusterAvailability
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
_cached = false;
|
_cached = false;
|
||||||
SkippedCount++;
|
System.Threading.Interlocked.Increment(ref SkippedCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _cached.Value;
|
return _cached.Value;
|
||||||
|
|||||||
Reference in New Issue
Block a user