Updating GH Workflow to validate policy file and meta names are the same (#1711)
Co-authored-by: Jack Tracey <41163455+jtracey93@users.noreply.github.com>
This commit is contained in:
Родитель
0b8d048b1a
Коммит
cbbf394b11
|
@ -109,6 +109,21 @@ Describe 'UnitTest-ModifiedPolicies' {
|
|||
}
|
||||
}
|
||||
|
||||
It "Check policy metadata name matches policy filename" {
|
||||
$ModifiedAddedFiles | ForEach-Object {
|
||||
$PolicyJson = Get-Content -Path $_ -Raw | ConvertFrom-Json
|
||||
$PolicyFile = Split-Path $_ -Leaf
|
||||
$PolicyMetadataName = $PolicyJson.name
|
||||
$PolicyFileNoExt = [System.IO.Path]::GetFileNameWithoutExtension($PolicyFile)
|
||||
if ($PolicyFileNoExt.Contains("AzureChinaCloud") -or $PolicyFileNoExt.Contains("AzureUSGovernment"))
|
||||
{
|
||||
$PolicyFileNoExt = $PolicyFileNoExt.Substring(0, $PolicyFileNoExt.IndexOf("."))
|
||||
}
|
||||
Write-Warning "$($PolicyFileNoExt) - This is the policy metadata name: $($PolicyMetadataName)"
|
||||
$PolicyMetadataName | Should -Be $PolicyFileNoExt
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Context "Validate policy parameters" {
|
||||
|
|
Загрузка…
Ссылка в новой задаче