Fix dashboard console logs page flaky test#13768
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13768Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13768" |
There was a problem hiding this comment.
Pull request overview
This PR fixes a flaky test by addressing a race condition in the console logs error handling logic. The test ReadingLogs_ErrorDuringRead_SetStatusAndLog was quarantined due to intermittent failures where the error status would be overwritten by the "finished watching logs" status in the finally block.
Key Changes:
- Introduces a
hasErrorflag to track whether an error occurred during log reading - Prevents the finally block from overwriting the error status with "finished watching logs" status
- Unquarantines the previously flaky test
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Aspire.Dashboard.Components.Tests/Pages/ConsoleLogsTests.cs | Removes quarantine attribute from the test and removes unused import |
| src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor.cs | Adds hasError flag to prevent overwriting error status in the finally block |
The implementation looks correct. The fix properly addresses the race condition by:
- Tracking when an error occurs via the
hasErrorflag (line 811) - Using this flag to prevent the finally block from overwriting the error status with the "finished" status (line 830)
This ensures that when an error occurs during log reading, the error status set at line 817 is preserved and not overwritten by the finally block at line 832.
Fixes #12740