-
Notifications
You must be signed in to change notification settings - Fork 459
Resolve test app names from app.json to prevent silent CI test skips #9059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Alexander Holstrup (aholstrup1)
merged 3 commits into
main
from
aholstrup1-subcontracting-test-investigation
Jul 7, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
c81813b
Resolve test app names from app.json to prevent silent test skips
aholstrup1 16aad11
Disable failing Subcontracting test WIPTransferRemainderCreatedWhenOp…
aholstrup1 cb65062
Disable failing Subscription Billing test DeferralsReleaseSucceedsWhe…
aholstrup1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 | ||
|
|
||
| Import-Module (Join-Path $PSScriptRoot '../ParallelTestExecution.psm1') -Force | ||
|
|
||
| Describe "ParallelTestExecution app-name resolution" { | ||
| BeforeAll { | ||
| # Create real app.json files on disk so Get-AppNameFromMetadata can read them. | ||
| $script:tempRoot = Join-Path ([System.IO.Path]::GetTempPath()) ("patest_" + [System.Guid]::NewGuid().ToString('N')) | ||
| New-Item -ItemType Directory -Path $script:tempRoot -Force | Out-Null | ||
|
|
||
| function New-AppJson { | ||
| param([string]$Folder, [string]$Name) | ||
| $dir = Join-Path $script:tempRoot $Folder | ||
| New-Item -ItemType Directory -Path $dir -Force | Out-Null | ||
| $path = Join-Path $dir 'app.json' | ||
| @{ name = $Name; id = [System.Guid]::NewGuid().ToString() } | ConvertTo-Json | Set-Content -Path $path -Encoding utf8 | ||
| return $path | ||
| } | ||
|
|
||
| # A metadata record whose projects.json key (ApplicationName) differs from its app.json name. | ||
| $script:mismatchAppJson = New-AppJson -Folder 'Mismatch' -Name 'Real App Name' | ||
| # A metadata record whose key and app.json name agree. | ||
| $script:matchAppJson = New-AppJson -Folder 'Match' -Name 'Aligned Tests' | ||
| } | ||
|
|
||
| AfterAll { | ||
| if (Test-Path $script:tempRoot) { Remove-Item $script:tempRoot -Recurse -Force -ErrorAction SilentlyContinue } | ||
| } | ||
|
|
||
| Context "Get-AppNameFromMetadata" { | ||
| It "returns the app.json name when it differs from the projects.json key" { | ||
| $md = [PSCustomObject]@{ ApplicationName = 'Projects-Json-Key'; AppJsonPath = $script:mismatchAppJson } | ||
| Get-AppNameFromMetadata -BuildMetadata $md | Should -Be 'Real App Name' | ||
| } | ||
|
|
||
| It "returns the app.json name when it matches the projects.json key" { | ||
| $md = [PSCustomObject]@{ ApplicationName = 'Aligned Tests'; AppJsonPath = $script:matchAppJson } | ||
| Get-AppNameFromMetadata -BuildMetadata $md | Should -Be 'Aligned Tests' | ||
| } | ||
|
|
||
| It "falls back to ApplicationName when the app.json path is missing" { | ||
| $md = [PSCustomObject]@{ ApplicationName = 'Fallback Name'; AppJsonPath = (Join-Path $script:tempRoot 'does-not-exist\app.json') } | ||
| Get-AppNameFromMetadata -BuildMetadata $md | Should -Be 'Fallback Name' | ||
| } | ||
|
|
||
| It "falls back to ApplicationName when AppJsonPath is empty" { | ||
| $md = [PSCustomObject]@{ ApplicationName = 'Fallback Name'; AppJsonPath = '' } | ||
| Get-AppNameFromMetadata -BuildMetadata $md | Should -Be 'Fallback Name' | ||
| } | ||
| } | ||
|
|
||
| Context "Get-InstalledTestAppNames resilience to key/name drift" { | ||
| It "dispatches a test app whose projects.json key differs from its installed (app.json) name" { | ||
| Mock -ModuleName ParallelTestExecution -CommandName Get-ApplicationGroup -MockWith { | ||
| @( | ||
| [PSCustomObject]@{ IsTest = $true; ApplicationName = 'Projects-Json-Key'; AppJsonPath = $script:mismatchAppJson } | ||
| [PSCustomObject]@{ IsTest = $true; ApplicationName = 'Aligned Tests'; AppJsonPath = $script:matchAppJson } | ||
| [PSCustomObject]@{ IsTest = $false; ApplicationName = 'Some Prod App'; AppJsonPath = $null } | ||
| ) | ||
| } | ||
| Mock -ModuleName ParallelTestExecution -CommandName Get-BcContainerAppInfo -MockWith { | ||
| @( | ||
| [PSCustomObject]@{ IsInstalled = $true; Name = 'Real App Name' } # installed under the app.json name | ||
| [PSCustomObject]@{ IsInstalled = $true; Name = 'Aligned Tests' } | ||
| ) | ||
| } | ||
|
|
||
| $result = Get-InstalledTestAppNames -ContainerName 'c' -Tenant 'default' -Country 'w1' | ||
|
|
||
| $result | Should -Contain 'Real App Name' | ||
| $result | Should -Contain 'Aligned Tests' | ||
| $result | Should -Not -Contain 'Projects-Json-Key' | ||
| } | ||
| } | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.