test: point the integration suite's colour expectations at StatusColors - #2119
Merged
Conversation
StatusColors members are theme brush keys now -- Good = "Success", Neutral = "TextMuted" -- and eleven assertions in SysManager.IntegrationTests still compared against the pre-migration hex literals. All eleven were permanently failing, and CI only compile-checks that project, so nothing said so. #2101 found nine in two files. Two more were in files it never named, both asserting hex SHAPE with Assert.Matches rather than a hex value -- so a search for colour literals could not see them. Each expectation now names the member the producer actually assigns, read off HealthAnalyzer. Worth recording what the old rows preserved: GameServer was #F72585 and StreamingService #B388FF, two colours that now both resolve to Info. The migration collapsed them and these tests would have said so had they been able to run. The two shape assertions use StatusColors.AllBrushKeys, added here as the five distinct keys. A copy of that list in the test would put a second source of truth inside the one class whose stated purpose is being the first. Also rewrites NavItems_CorrectOrder_AboutLast, which asserted NavItems.Last().Id == "nav-about" and had been red since the Advanced group was appended after Info. Now NavItems_AboutIsLastInTheInfoGroup: About's position within its group cannot rot when a group is appended, only when About itself moves. Ten of the eleven are pure and were proven red against the shipped state through a runner pointed at that assembly; the eleventh needs live WMI and shares its shape with one that was proven.
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.
Closes the first half of #2101 — and corrects its count.
Eleven assertions, not nine, across four files
StatusColorsmembers are theme brush KEYS now (Good = "Success",Neutral = "TextMuted"), and every producer of a*ColorHexproperty assigns one. Eleven assertions inSysManager.IntegrationTestsstill compared against the pre-migration hex literals, so all eleven were permanently failing — and CI onlydotnet builds that project, so nothing said so.#2101 found nine in two files. Two more turned up while fixing them, in files the issue never named:
HealthAnalyzerExtendedTests.csAssert.Equalplus 7[InlineData]rowsHealthDiagnosticTests.csAssert.Equal("#9AA0A6", d.ColorHex)SystemHealthViewModelExtendedTests.csAssert.Matches("^#[0-9A-Fa-f]{6}$", …)DiskHealthServiceTests.csVerdictColorHexThe two
Assert.Matchesare why the issue missed them: it searched for hex literals, and a regex asserting hex shape contains no colour to grep for. The runner found them, not me.Repointed at the member, not its value
Each expectation now names the
StatusColorsmember the producer actually assigns — read offHealthAnalyzerrather than inferred:GoodBadWarningInfoNeutralWorth noting what the old rows recorded: GameServer was
#F72585and StreamingService#B388FF, two distinct colours that now both resolve toInfo. The migration collapsed them, and these tests would have said so had they been able to run.The two shape assertions get
Assert.Contains(value, StatusColors.AllBrushKeys)— a stronger claim than the old regex, since it names the permitted set rather than a character class.One production line
StatusColors.AllBrushKeys— the five distinct keys (ElevatedsharesWarning's). A copy of that list in the test would put a second source of truth inside the one class whose stated purpose is being the first. It adds no behaviour.Also: the nav-order test asserted the wrong tab
NavItems_CorrectOrder_AboutLastassertedNavItems.Last().Id == "nav-about". Appending the Advanced group after Info made the real last entrynav-env-variables, and the test had been red ever since.Rewritten rather than deleted, to the invariant that survived the change:
NavItems_AboutIsLastInTheInfoGroup. Asserting About's position within its group cannot rot when a group is appended — only when About itself moves, which is the thing worth catching.Verification
Ten of the eleven are pure computation and were run through a throwaway runner pointed at the integration assembly (kept outside the repo, so there is nothing to exclude from git). Reverting every expectation to its pre-migration literal — the state that shipped — gives:
13 green, 0 red after restore, with all three files hashed identical.
The eleventh is not run here:
DiskHealthServiceTests.EachReport_HasFriendlyNameAndMediacallsCollectAsync()and needs live WMI. Its assertion is the same shape as theDefaults_AreSafeone above, which is run and shows the exact failure.Not addressed here: #2101's second point, that a project whose assertions cannot run anywhere in the pipeline will rot again. That is a CI question — a scheduled non-blocking job, or moving the pure assertions into the blocking suite — and it stays open on the issue.
Builds 0 errors / 0 warnings on all four projects,
dotnet format --verify-no-changesclean on all four, 190 cases green inArchitectureTestsand the theme-contrast suites.test:— no version bump, no CHANGELOG, no release.