fix: prevent tests hanging when InitializeAsync throws (#4715)#4717
Merged
fix: prevent tests hanging when InitializeAsync throws (#4715)#4717
Conversation
…ssDataSource dependencies (#4715) Three bugs combined to cause indefinite hangs when IAsyncDiscoveryInitializer.InitializeAsync() throws: 1. CreateFailedTestDetails called InitializeAttributesAsync — the exact method that caused the original exception — re-triggering the failure inside the catch block. Made it synchronous with empty attributes matching the safe TestBuilderPipeline pattern. 2. FailedExecutableTest in TestBuilder was missing State=Failed and Result, so failed tests didn't get the early-exit in TestCoordinator.ExecuteTestInternalAsync. 3. The 5-minute discovery timeout CTS was created but the original cancellationToken was passed instead of cts.Token, so the timeout was never applied. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. SummaryThis PR fixes three critical bugs that could cause test hangs when
All changes align with existing patterns in |
This was referenced Feb 10, 2026
This was referenced Feb 14, 2026
Open
Chore(deps): Bump TUnit.Assertions from 1.12.111 to 1.15.0
code-of-chaos/cs_code-of_chaos-testing#91
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CreateFailedTestDetailscalledInitializeAttributesAsync()— the exact method that caused the original exception — re-triggering the failure inside thecatchblock. Made it synchronous with empty attributes, matching the safeTestBuilderPipelinepattern.FailedExecutableTestinTestBuilderwas missingState = TestState.FailedandResult, so failed tests didn't get the early-exit inTestCoordinator.ExecuteTestInternalAsync. Added both to match theTestBuilderPipelineversion.TestDiscoveryService.DiscoverTestsStreamAsyncwas created but the originalcancellationTokenwas passed toBuildTestsStreamingAsyncinstead ofcts.Token, so the timeout was never applied.Closes #4715
Test plan
InitializeAsyncnow report as failed instead of hanging🤖 Generated with Claude Code