Test that a writer and a reader share the injected IRunSettingsHelper#16207
Merged
nohwnd merged 1 commit intoJul 3, 2026
Merged
Conversation
…Helper The whole point of injecting IRunSettingsHelper is that a flag written while parsing arguments is read back later through the same instance. Nothing in the suite pinned that down, so a later change could hand the writer and the reader two different objects and design-mode propagation would break with no test turning red. This adds one test that drives both ends against a single injected instance: PlatformArgumentExecutor is the writer (it sets IsDefaultTargetArchitecture to false), and TestRequestManager is the reader (GetDefaultArchitecture consults the flag). The run settings ask for <DefaultPlatform>ARM</DefaultPlatform>, an architecture the tests never run on, so the two branches of the flag resolve to different results and the assertion can only pass when the reader observes the writer's flip through the shared helper. The writer gets a throwaway CommandLineOptions to keep the write isolated to the helper under test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a unit test to pin down the contract introduced in #16205: argument processors that write request-scoped runsettings flags and engine components that read them must observe the same injected IRunSettingsHelper instance (to avoid silent design-mode/architecture propagation regressions).
Changes:
- Adds a new
TestRequestManagerTeststest that flipsIsDefaultTargetArchitectureviaPlatformArgumentExecutorand verifiesTestRequestManagerobserves the flipped value when inferring default architecture during discovery. - Introduces a unit-test dependency on the processors test namespace to construct the writer side (
PlatformArgumentExecutor) in the same test.
Comment on lines
+2905
to
+2919
| // GetDefaultArchitecture honors <DefaultPlatform> only while IsDefaultTargetArchitecture is true; once the flag | ||
| // is false it returns the run configuration's TargetPlatform default instead. ARM is used as the <DefaultPlatform> | ||
| // because it is never the architecture the tests actually run on, so the two branches resolve to different values | ||
| // and the assertion below can only pass if the writer's flip was observed by the reader through the shared helper. | ||
| var payload = new DiscoveryRequestPayload() | ||
| { | ||
| Sources = new List<string>() { "AnyCPU.dll" }, | ||
| RunSettings = | ||
| @"<?xml version=""1.0"" encoding=""utf-8""?> | ||
| <RunSettings> | ||
| <RunConfiguration> | ||
| <DefaultPlatform>ARM</DefaultPlatform> | ||
| </RunConfiguration> | ||
| </RunSettings>" | ||
| }; |
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.
#16205 injected
IRunSettingsHelperinto the argument processors so the request-scoped flags it carries —IsDefaultTargetArchitectureandIsDesignMode— flow through one instance instead of theRunSettingsHelper.Instancestatic. The whole point of that seam is that a flag written while parsing arguments is read back later through the same instance. Nothing in the suite pinned that down, so a later change could hand the writer and the reader two different objects and design-mode propagation would break with no test turning red.This adds one test that drives both ends against a single injected instance.
PlatformArgumentExecutoris the writer — parsing--PlatformflipsIsDefaultTargetArchitectureto false — andTestRequestManageris the reader, which consults the flag inGetDefaultArchitecture. The run settings ask for<DefaultPlatform>ARM</DefaultPlatform>, an architecture the tests never actually run on, so the two branches of the flag resolve to different results and the assertion can only pass when the reader observes the writer's flip through the shared helper. The writer gets a throwawayCommandLineOptionsso the write stays isolated to the helper under test.It is test-only; there is no product change.
Verification
vstest.console.UnitTestsonnet481: 636 passed, 0 failed, 2 skipped (638 total) — the new test is the +1 over the prior 637 total.IDE0005.