Skip to content

Commit

Permalink
Test-AzTemplate: Skipping nested templates for prereq,parameters, and…
Browse files Browse the repository at this point in the history
… CreateUIDefinition (because they cannot have them) (Fixes Azure#686, makes Azure#680 more quiet)
  • Loading branch information
James Brundage committed Sep 23, 2022
1 parent f26ac13 commit b39a037
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions arm-ttk/Test-AzTemplate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,13 @@ Each test script has access to a set of well-known variables:
}
}

if ($testOut.InnerTemplateLocation) {
if ($testOut.InnerTemplateLocation -and $location) {
$location.Line += $testOut.InnerTemplateLocation.Line - 1
}

$testOut | Add-Member NoteProperty Location $location -Force
if ($location) {
$testOut | Add-Member NoteProperty Location $location -Force
}
}
}
elseif ($testOut -is [Management.Automation.WarningRecord]) {
Expand Down Expand Up @@ -565,12 +567,20 @@ Each test script has access to a set of well-known variables:
$templateFileName = $fileInfo.Name
$TemplateObject = $fileInfo.Object
$TemplateText = $fileInfo.Text
# If the file had inner templates
if ($fileInfo.InnerTemplates) {
# use the inner templates from just this file
$InnerTemplates = $fileInfo.InnerTemplates
$InnerTemplatesText = $fileInfo.InnerTemplatesText
$InnerTemplatesNames = $fileInfo.InnerTemplatesNames
$innerTemplatesLocations = $fileInfo.InnerTemplatesLocations
} else {
}
elseif ($fileInfo.Name -match '^(?>parameters|prereq|CreateUIDefinition)\.') {
$InnerTemplates, $InnerTemplateText, $InnerTemplatesNames, $innerTemplatesLocations = $null
}
else
{
# Otherwise, use the inner templates from the main file
$InnerTemplates = $mainInnerTemplates
$InnerTemplatesText = $mainInnerTemplatesText
$InnerTemplatesNames = $MainInnerTemplatesNames
Expand Down

0 comments on commit b39a037

Please sign in to comment.