Skip to content

[devops] Fix a few issues with pwsh tests and test result parsing.#24516

Merged
rolfbjarne merged 2 commits intomainfrom
dev/rolf/devops-fix-tests
Jan 20, 2026
Merged

[devops] Fix a few issues with pwsh tests and test result parsing.#24516
rolfbjarne merged 2 commits intomainfrom
dev/rolf/devops-fix-tests

Conversation

@rolfbjarne
Copy link
Member

  • 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.

* 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.
Copy link
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 fixes two issues in the DevOps automation scripts: a PowerShell parsing error when processing test results that occurred when calling .Contains() on a character instead of a string, and improves tests for checking if a commit is the latest in a PR by using a public function instead of directly instantiating internal classes.

Changes:

  • Fixed test result parsing by wrapping Get-Content output in an array to ensure string methods are available
  • Separated logic for adding <summary> and <details> tags based on what's found in test result files
  • Added a public wrapper function Get-IsCurrentCommitLatestInPR for better testability
  • Updated tests to use the new public function instead of directly manipulating internal class instances

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tools/devops/automation/scripts/TestResults.psm1 Fixed parsing logic to handle test result files correctly by ensuring array output and separating <summary> and <details> handling
tools/devops/automation/scripts/TestResults.Tests.ps1 Updated expected test output to match the corrected parsing behavior
tools/devops/automation/scripts/GitHub.psm1 Added public wrapper function Get-IsCurrentCommitLatestInPR and exported it
tools/devops/automation/scripts/GitHub.Tests.ps1 Updated tests to use the new public function instead of directly instantiating internal classes

Comment on lines +268 to +274
Mock Invoke-Request {
return @{
"head" = @{
"sha" = "different123hash"
}
}
} -ModuleName 'GitHub'
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The mock in the test 'returns true when not in PR context' is unnecessary. Since an empty PR IDs array is passed, the IsCurrentCommitLatestInPR method will return true without making any API call, so this mock will never be invoked. The mock should be removed or the test should verify that Invoke-Request is not called.

Copilot uses AI. Check for mistakes.
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #f0dc8ba] Build passed (Build packages) ✅

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #f0dc8ba] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #f0dc8ba] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f0dc8ba] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f0dc8ba] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f0dc8ba] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f0dc8ba] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne enabled auto-merge (squash) January 19, 2026 08:18
@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f0dc8ba] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #f0dc8ba] 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
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 9 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: f0dc8ba4cd9c4d1e2c7793ecfd130eeb31c58d7a [PR build]

@rolfbjarne rolfbjarne merged commit 561bb5c into main Jan 20, 2026
45 checks passed
rolfbjarne added a commit that referenced this pull request Jan 20, 2026
…24516)

* 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.
rolfbjarne added a commit that referenced this pull request Jan 20, 2026
…24516)

* 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.
rolfbjarne added a commit that referenced this pull request Jan 28, 2026
… result parsing. (#24572)

* 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.
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.

4 participants