Skip to content

[fix] Fix flaky EnableLoggersArgumentProcessorTests on macOS#16054

Open
nohwnd wants to merge 1 commit into
mainfrom
fix/issue-15614-flaky-logger-test-8c7a22ba45cba6a6
Open

[fix] Fix flaky EnableLoggersArgumentProcessorTests on macOS#16054
nohwnd wants to merge 1 commit into
mainfrom
fix/issue-15614-flaky-logger-test-8c7a22ba45cba6a6

Conversation

@nohwnd
Copy link
Copy Markdown
Member

@nohwnd nohwnd commented May 23, 2026

Summary

🤖 This is an automated fix by the Issue Repro Triage agent.

Fixes #15614

Root Cause

EnableLoggersArgumentProcessorTests uses RunSettingsManager.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 = null in both [TestInitialize] and [TestCleanup]:

  • TestInitialize: ensures a fresh RunSettingsManager before each test, regardless of what previous tests left behind
  • TestCleanup: leaves the singleton in a clean state for subsequent tests

This matches the existing pattern in RunSettingsManagerTests.cs, which already resets RunSettingsManager.Instance = null in its TestCleanup.

Verification

All 15 tests in EnableLoggersArgumentProcessorTests pass after the change.

🔍 Triaged by Issue Repro Triage & Auto-Fix 🔍

…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>
Copilot AI review requested due to automatic review settings May 23, 2026 01:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Instance to null in [TestInitialize] to start each test with a fresh singleton.
  • Add a [TestCleanup] method that also resets RunSettingsManager.Instance to null to avoid leaving shared state behind for subsequent tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExecutorInitializeShouldAddLoggerWithFriendlyNameInRunSettingsIfNamePresentInArg flaky on macos

2 participants