-
Notifications
You must be signed in to change notification settings - Fork 285
Fix flaky AbortWithCTRLPlusC_TestHost_Succeeded
test by ensuring console output is flushed during cancellation
#5942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Evangelink <[email protected]>
AbortWithCTRLPlusC_TestHost_Succeeded
is too flakyAbortWithCTRLPlusC_TestHost_Succeeded
test by ensuring console output is flushed during cancellation
The error is usually:
Are you sure the fix is correct? |
... You're absolutely right to question this. The error output shows the cancellation message IS appearing (so the Console.Out.Flush() is working), but the test run summary shows "Zero tests ran" instead of "Aborted". This indicates a race condition between the abort callback setting Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…e state Co-authored-by: Evangelink <[email protected]>
// Ensure the cancellation message is flushed to the output stream before the process can terminate. | ||
// This prevents race conditions in CI environments where the process might exit before the message | ||
// is visible in the captured output. | ||
Console.Out.Flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed?
@@ -780,6 +784,11 @@ public void StartCancelling() | |||
terminal.AppendLine(PlatformResources.CancellingTestSession); | |||
terminal.AppendLine(); | |||
}); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix formatting issue
Replaced by #6108 |
Problem
The test
AbortWithCTRLPlusC_TestHost_Succeeded
was flaky due to a race condition where the cancellation message "Canceling the test session..." was not consistently appearing in the captured output. This happened because:TerminalTestReporter.StartCancelling()
writes the cancellation messageSolution
Added
Console.Out.Flush()
call inTerminalTestReporter.StartCancelling()
to ensure the cancellation message is immediately written to the output stream before the process can terminate.Impact
This is a minimal, targeted fix that addresses the root cause without affecting other functionality.
Fixes #5785.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
cflvsblobprodcus383.vsblob.vsassets.io
/home/REDACTED/work/testfx/testfx/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/testfx/testfx/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/testfx/testfx/artifacts/toolset/10.0.0-beta.25353.1.txt
(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.