fix: prevent flaky tests by disabling parallel execution for registry tests#584
fix: prevent flaky tests by disabling parallel execution for registry tests#584natemcmaster merged 1 commit intomainfrom
Conversation
… tests
Tests using CommandMetadataRegistry share static state and were failing
intermittently when run in parallel. Added [Collection("MetadataRegistry")]
attribute to all test classes that interact with the registry to ensure
they run sequentially.
Affected test classes:
- CommandMetadataRegistryTests
- ConventionAotPathTests
- MetadataProviderTests
- RemainingArgsPropertyConventionTests
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #584 +/- ##
=======================================
Coverage 79.93% 79.93%
=======================================
Files 120 120
Lines 4017 4017
Branches 872 872
=======================================
Hits 3211 3211
Misses 618 618
Partials 188 188 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review - PR 584This PR effectively addresses flaky test failures caused by parallel execution of tests sharing the static CommandMetadataRegistry. The approach is sound and follows xUnit best practices. Strengths:
Areas for Improvement:
Verdict: Approve with minor suggestions. The PR solves the immediate flakiness problem effectively. The cleanup suggestions are optional improvements - current implementation is acceptable given sequential execution. |
Summary
[Collection("MetadataRegistry")]attribute to test classes that useCommandMetadataRegistryProblem
Tests using
CommandMetadataRegistryshare static state and were failing intermittently when xUnit ran them in parallel with other test classes. One test would callClear()while another was mid-execution.Solution
All test classes that interact with the registry now use the same xUnit collection with
DisableParallelization = true, ensuring they run sequentially.Affected test classes
CommandMetadataRegistryTestsConventionAotPathTestsMetadataProviderTestsRemainingArgsPropertyConventionTestsTest plan
./build.ps1)🤖 Generated with Claude Code