@@ -21,6 +21,9 @@ param (
2121 [Parameter (Mandatory = $true , Position = 0 )]
2222 [string ] $ServiceDirectory ,
2323
24+ [Parameter ()]
25+ [string ] $TestResourcesDirectory ,
26+
2427 [Parameter ()]
2528 [ValidatePattern (' ^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$' )]
2629 [string ] $TestApplicationId ,
@@ -351,6 +354,14 @@ try {
351354 # Enumerate test resources to deploy. Fail if none found.
352355 $repositoryRoot = " $PSScriptRoot /../../.." | Resolve-Path
353356 $root = [System.IO.Path ]::Combine($repositoryRoot , " sdk" , $ServiceDirectory ) | Resolve-Path
357+ if ($TestResourcesDirectory ) {
358+ $root = $TestResourcesDirectory | Resolve-Path
359+ # Add an explicit check below in case ErrorActionPreference is overridden and Resolve-Path doesn't stop execution
360+ if (! $root ) {
361+ throw " TestResourcesDirectory '$TestResourcesDirectory ' does not exist."
362+ }
363+ Write-Verbose " Overriding test resources search directory to '$root '"
364+ }
354365 $templateFiles = @ ()
355366
356367 " $ResourceType -resources.json" , " $ResourceType -resources.bicep" | ForEach-Object {
@@ -809,7 +820,13 @@ group that will be created.
809820. PARAMETER ServiceDirectory
810821A directory under 'sdk' in the repository root - optionally with subdirectories
811822specified - in which to discover ARM templates named 'test-resources.json' and
812- Bicep templates named 'test-resources.bicep'. This can also be an absolute path
823+ Bicep templates named 'test-resources.bicep'. This can be an absolute path
824+ or specify parent directories. ServiceDirectory is also used for resource and
825+ environment variable naming.
826+
827+ . PARAMETER TestResourcesDirectory
828+ An override directory in which to discover ARM templates named 'test-resources.json' and
829+ Bicep templates named 'test-resources.bicep'. This can be an absolute path
813830or specify parent directories.
814831
815832. PARAMETER TestApplicationId
0 commit comments