diff --git a/Actions/CreateApp/CreateApp.ps1 b/Actions/CreateApp/CreateApp.ps1 index 879c4ff60c..5b76df1847 100644 --- a/Actions/CreateApp/CreateApp.ps1 +++ b/Actions/CreateApp/CreateApp.ps1 @@ -59,10 +59,13 @@ try { $sampleApp = (Get-Item -Path $sampleApp).FullName } else { - $sampleApp = Join-Path $folders[1] "Applications\testframework\performancetoolkit\Microsoft_Performance Toolkit Samples.app" + # Narrow the search to the Applications subdirectory if present, to avoid traversing the entire artifact tree + $searchRoot = Get-ChildItem -Path $folders[1] -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -ieq 'Applications' } | Select-Object -First 1 -ExpandProperty FullName + if (!$searchRoot) { $searchRoot = $folders[1] } + $sampleApp = Get-ChildItem -Path $searchRoot -Filter "Microsoft_Performance Toolkit Samples.app" -File -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName } - if (!(Test-Path -Path $sampleApp)) { - throw "Could not locate sample app for the Business Central version" + if (!$sampleApp -or !(Test-Path -Path $sampleApp)) { + throw "Could not locate 'Microsoft_Performance Toolkit Samples.app' under '$($folders[1])'" } Extract-AppFileToFolder -appFilename $sampleApp -generateAppJson -appFolder $tmpFolder diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 7e98ef896c..48be9fdae3 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -26,6 +26,7 @@ The `DownloadProjectDependencies` action now downloads only artifacts from depen - Issue 2211 - Cannot create a release if a project contains only test apps - Issue 2214 - Workspace compilation not working with external dependencies - Issue 2235 - Workspace compilation: only the first `customCodeCops` entry resolved when multiple relative paths were configured. Relative `customCodeCops` paths are now resolved against the project folder before being passed to the compiler. +- Issue 2265 - Creating a Performance Test App fails on Linux due to case-sensitive path lookup for the Performance Toolkit sample app ## v9.0 diff --git a/Tests/CreateApp.Action.Test.ps1 b/Tests/CreateApp.Action.Test.ps1 index 0094d60f4d..32424b703b 100644 --- a/Tests/CreateApp.Action.Test.ps1 +++ b/Tests/CreateApp.Action.Test.ps1 @@ -25,4 +25,28 @@ Describe "CreateApp Action Tests" { # Call action + It 'Should find Performance Toolkit sample app with directory casing' -TestCases @( + @{ Casing = 'PascalCase'; Dirs = @('Applications', 'TestFramework', 'performancetoolkit') } + @{ Casing = 'lowercase'; Dirs = @('applications', 'testframework', 'performancetoolkit') } + ) { + param($Casing, $Dirs) + $tempDir = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) + try { + $sampleAppDir = Join-Path $tempDir $Dirs[0] $Dirs[1] $Dirs[2] + New-Item -Path $sampleAppDir -ItemType Directory -Force | Out-Null + $sampleAppFile = Join-Path $sampleAppDir "Microsoft_Performance Toolkit Samples.app" + Set-Content -Path $sampleAppFile -Value "dummy" + + # Use the same lookup logic as in CreateApp.ps1: narrow to Applications subdirectory first + $searchRoot = Get-ChildItem -Path $tempDir -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -ieq 'Applications' } | Select-Object -First 1 -ExpandProperty FullName + if (!$searchRoot) { $searchRoot = $tempDir } + $result = Get-ChildItem -Path $searchRoot -Filter "Microsoft_Performance Toolkit Samples.app" -File -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName + + $result | Should -Not -BeNullOrEmpty + $result | Should -Be $sampleAppFile + } + finally { + Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue + } + } }