[fix] Fix flaky EnableLoggersArgumentProcessorTests on macOS#16054
Open
nohwnd wants to merge 1 commit into
Open
[fix] Fix flaky EnableLoggersArgumentProcessorTests on macOS#16054nohwnd wants to merge 1 commit into
nohwnd wants to merge 1 commit into
Conversation
…sManager The test class uses RunSettingsManager.Instance (a static singleton) but did not reset it between tests, causing potential cross-test contamination on macOS where test execution order may differ. Add TestInitialize reset and TestCleanup to ensure each test starts with and leaves behind a clean RunSettingsManager state. This matches the existing pattern in RunSettingsManagerTests.cs. Fixes #15614 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses macOS flakiness in EnableLoggersArgumentProcessorTests by ensuring the static RunSettingsManager.Instance singleton does not leak state between test runs, keeping the unit test environment deterministic.
Changes:
- Reset
RunSettingsManager.Instancetonullin[TestInitialize]to start each test with a fresh singleton. - Add a
[TestCleanup]method that also resetsRunSettingsManager.Instancetonullto avoid leaving shared state behind for subsequent tests.
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
🤖 This is an automated fix by the Issue Repro Triage agent.
Fixes #15614
Root Cause
EnableLoggersArgumentProcessorTestsusesRunSettingsManager.Instance— a static singleton — but did not reset it in[TestInitialize]or[TestCleanup]. When tests from other classes run in parallel and mutate this shared singleton, the state bleeds into these tests, causing non-deterministic failures (particularly on macOS where test execution order can differ).Fix
Added
RunSettingsManager.Instance = nullin both[TestInitialize]and[TestCleanup]:TestInitialize: ensures a freshRunSettingsManagerbefore each test, regardless of what previous tests left behindTestCleanup: leaves the singleton in a clean state for subsequent testsThis matches the existing pattern in
RunSettingsManagerTests.cs, which already resetsRunSettingsManager.Instance = nullin itsTestCleanup.Verification
All 15 tests in
EnableLoggersArgumentProcessorTestspass after the change.