Skip to content

Commit aa053e9

Browse files
authored
Correct location handling, fix tests and consistency (#24573)
* Update to autorest 4.x Update to Azure Policy 2023-04-01 Move to non-versioned interface types Complete full test suite for existing cmdlets Few bug fixes Add completer for Location parameter Fix record/playback, remove -LiveOnly tags Make test names repeatable to work with record/playback Implement resource group functions that became inaccessible Fix test failures due to default parameter injection * Clean up some transforms in README Remove unsupported (for now) parameters Streamline common test code Move common test code to utils.ps1 Add serialization of test variables to env.json * Remove extra parameters from Get-AzPolicyAssignment Rerecord the tests * Fix $testFilesFolder calculation to work on macOS/linux. * Hide generated parameter sets for New-* Correct definitions, validation, and tests for New-AzPolicyAssignment parameters Re-record all tests * Replace Get-AzContext with Utils\Get-SubscriptionIdTestSafe Move to autorest 4.0.690 Update managed identity properties to match generation changes Remove several parameter transforms no longer needed Rerecord all tests 91 tests still failing on -Playback with the same signature * Remove location completer from exports/docs/examples/help * Improve location completer tests * Remove transforms for Scope and Id parameters no longer needed Update cmdlets to use Scope and Id directly Rerecord all tests All tests pass in -Record mode Failures in -Playback mode unchanged * Change location completer to lazy load (vs. module load) Preserve "extra" input parameters in Update-* calls to Get-* in order to support -Playback test mode Tag test files that don't support -Playback mode as LiveOnly Rerecord all recording files * Minor updates for consistency Rerecord all tests Move 4 test files back to LiveOnly * Updates for consistency and to fix tests Make changes to ensure consistent and valid handling of $location Rerecord tests * Fix bad merge Rerecord two test files * Re-record tests
1 parent c27c2a9 commit aa053e9

File tree

92 files changed

+18442
-14691
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+18442
-14691
lines changed

src/Resources/Policy.Autorest/custom/Get-AzPolicyAssignment.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ process {
205205
switch ($resolved.ScopeType) {
206206
'mgName' {
207207
if ($IncludeDescendent) {
208-
throw 'The -IncludeDescendent switch is not supported for management group scopes.'
208+
throw 'The IncludeDescendent switch is not supported for management group scopes.'
209209
}
210210

211211
$calledParameterSet = 'List2'

src/Resources/Policy.Autorest/custom/Get-AzPolicyDefinition.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ process {
189189

190190
# handle disallowed cases not handled by PS parameter attributes
191191
if ($PSBoundParameters['SubscriptionId'] -and $PSBoundParameters['ManagementGroupName']) {
192-
throw 'Only -ManagementGroupName or -SubscriptionId can be provided, not both.'
192+
throw 'Only ManagementGroupName or SubscriptionId can be provided, not both.'
193193
}
194194

195195
# handle specific parameter sets

src/Resources/Policy.Autorest/custom/Get-AzPolicyExemption.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ process {
207207
switch ($resolved.ScopeType) {
208208
'mgName' {
209209
if ($IncludeDescendent) {
210-
throw 'The -IncludeDescendent switch is not supported for management group scopes.'
210+
throw 'The IncludeDescendent switch is not supported for management group scopes.'
211211
}
212212

213213
$calledParameterSet = 'List3'

src/Resources/Policy.Autorest/custom/Get-AzPolicySetDefinition.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ process {
182182

183183
# handle disallowed cases not handled by PS parameter attributes
184184
if ($PSBoundParameters['SubscriptionId'] -and $PSBoundParameters['ManagementGroupName']) {
185-
throw 'Only -ManagementGroupName or -SubscriptionId can be provided, not both.'
185+
throw 'Only ManagementGroupName or SubscriptionId can be provided, not both.'
186186
}
187187

188188
# handle specific parameter sets

src/Resources/Policy.Autorest/test/Backcompat/Backcompat-GetBuiltinsByName.Recording.json

Lines changed: 3228 additions & 3228 deletions
Large diffs are not rendered by default.

src/Resources/Policy.Autorest/test/Backcompat/Backcompat-GetCmdletFilterParameter.Recording.json

Lines changed: 80 additions & 80 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)