[release/10.0.1xx] [devops] Fix a few issues with pwsh tests and test result parsing.#24572
Conversation
* Fix an issue parsing test results, causing errors like:
Failed to compute test summaries: Method invocation failed because [System.Char] does not contain a method named 'Contains'.
* Fix tests related to checking if a commit is the last in a PR.
There was a problem hiding this comment.
Pull request overview
This PR refines Azure DevOps test summary parsing and exposes a simple helper for checking whether the current commit is the latest in a PR, adding and updating tests to validate these behaviors.
Changes:
- Fix
ParallelTestsResults.WriteCommentto correctly parse existing<summary>/<details>/## Failed testsblocks, avoid the[System.Char].Containserror by forcingGet-Contentto produce an array, and prevent duplicating or truncating Markdown sections. - Extend and adjust
TestResults.Tests.ps1to cover scenarios with multiple failing test suites, richer macOS failure summaries, and ensure aggregate counts and rendered Markdown match the new parsing behavior. - Add a
Get-IsCurrentCommitLatestInPRfunction inGitHub.psm1, export it from the module, and updateGitHub.Tests.ps1to assert correct behavior in PR and non‑PR contexts via this new API.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tools/devops/automation/scripts/TestResults.psm1 |
Improves test summary Markdown parsing in ParallelTestsResults.WriteComment, handling existing <details>/<summary> blocks and fixing the .Contains on char issue by treating file contents as a string array. |
tools/devops/automation/scripts/TestResults.Tests.ps1 |
Updates and adds test fixtures and expectations to validate new summary parsing behavior and scenarios with additional failing macOS tests. |
tools/devops/automation/scripts/GitHub.psm1 |
Introduces and exports Get-IsCurrentCommitLatestInPR, a small wrapper around GitHubComments.IsCurrentCommitLatestInPR for easier use in scripts. |
tools/devops/automation/scripts/GitHub.Tests.ps1 |
Refactors existing tests to use Get-IsCurrentCommitLatestInPR and verifies correct results when the current commit matches/does not match the PR head and when no PR context exists. |
✅ [CI Build #d891650] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #d891650] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #d891650] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #d891650] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #d891650] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #d891650] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #d891650] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #d891650] Tests on macOS arm64 - Mac Tahoe (26) passed 💻✅ All tests on macOS arm64 - Mac Tahoe (26) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #d891650] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 117 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Fix an issue parsing test results, causing errors like:
Failed to compute test summaries: Method invocation failed because [System.Char] does not contain a method named 'Contains'.
Fix tests related to checking if a commit is the last in a PR.
Backport of #24516.