Skip to content

Azure.Sdk.Tools.SwaggerApiParser_1.0.2-dev.20221110.2

Pre-release
Pre-release
Compare
Choose a tag to compare
@azure-sdk azure-sdk released this 10 Nov 21:47
6a50931
Add optional TestResourcesDirectory override parameter (#4623)

Resolves #4450

This adds an optional `TestResourcesDirectory` parameter to `New-TestResources.ps1` to enable searching for templates outside the immediate service directory (the specific scenario in mind is a sub-project directory).

There are a couple benefits and drawbacks to the approach I took here:

- In this PR, the resource and environment variable naming is still determined by the service directory. This means that no test code needs to be changed to handle new environment variable prefixes.
- A drawback of ^^ is parallel local testing of multiple sub-projects within the same service directory will cause resource and environment variable naming conflicts, unless `-BaseName` is also passed in. 
- The above drawback could be partially addressed by determining resource naming based on `TestResourcesDirectory` but keeping the environment variable behavior. That way you could deploy in multiple shell sessions without env var overlap. However, this will require people to run `Update-TestResources.ps1` and `Remove-TestResources.ps1` with a `TestResourcesDirectory` parameter as well in order for us to discover the resource group name consistently. I think it is better to prioritize keeping the update/remove scripts simple and require `-BaseName` for parallel local testing of sub-projects.