Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefajers authored Feb 27, 2024
1 parent 5ca9602 commit f7a87ca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Describe "Scenario - policyAssignments" {
$deleteSetContents += $script:file
$deleteSetContents += [Environment]::NewLine
$deleteSetContents += (Get-Content $script:file)
Remove-Item -Path $script:file -Force
try {
Write-PSFMessage -Level Debug -Message "Deletion Scenario $script:resourceType starting: $script:file" -FunctionName "Functional Tests"
$script:deletion = Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Describe "Scenario - roleAssignments" {
$deleteSetContents += $script:file
$deleteSetContents += [Environment]::NewLine
$deleteSetContents += (Get-Content $script:file)
Remove-Item -Path $script:file -Force
try {
Write-PSFMessage -Level Debug -Message "Deletion Scenario $script:resourceType starting: $script:file" -FunctionName "Functional Tests"
$script:deletion = Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents
Expand Down
14 changes: 14 additions & 0 deletions src/tests/integration/Repository.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,12 @@ Describe "Repository" {
$DeleteSetContents += $Script:locksFile
$DeleteSetContents += [Environment]::NewLine
$DeleteSetContents += (Get-Content $Script:locksFile)
Remove-Item -Path $script:policyAssignmentsFile -Force
Remove-Item -Path $Script:policyDefinitionsFile -Force
Remove-Item -Path $Script:policySetDefinitionsFile -Force
Remove-Item -Path $Script:policyExemptionsFile -Force
Remove-Item -Path $Script:roleAssignmentsFile -Force
Remove-Item -Path $Script:locksFile -Force
Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents
}

Expand Down Expand Up @@ -1064,6 +1070,7 @@ Describe "Repository" {
$DeleteSetContents += $Script:policyDefinitionsDepFile
$DeleteSetContents += [Environment]::NewLine
$DeleteSetContents += (Get-Content $Script:policyDefinitionsDepFile)
Remove-Item -Path $Script:policyDefinitionsDepFile -Force
{Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents -WhatIf:$true} | Should -Throw
}
It "Deletion of policySetDefinitionsFile with assignment dependency should fail" {
Expand All @@ -1074,6 +1081,7 @@ Describe "Repository" {
$DeleteSetContents += $Script:policySetDefinitionsDepFile
$DeleteSetContents += [Environment]::NewLine
$DeleteSetContents += (Get-Content $Script:policySetDefinitionsDepFile)
Remove-Item -Path $Script:policySetDefinitionsDepFile -Force
{Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents -WhatIf:$true} | Should -Throw
}
It "Deletion of policyDefinitionsFile with setDefinition dependency should fail" {
Expand All @@ -1084,6 +1092,7 @@ Describe "Repository" {
$DeleteSetContents += $script:policyDefinitionsDep2File
$DeleteSetContents += [Environment]::NewLine
$DeleteSetContents += (Get-Content $script:policyDefinitionsDep2File)
Remove-Item -Path $script:policyDefinitionsDep2File -Force
{Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents -WhatIf:$true} | Should -Throw
}
It "Deletion of policyAssignmentFile with role assignment dependency should fail" {
Expand All @@ -1094,6 +1103,7 @@ Describe "Repository" {
$DeleteSetContents += $script:policyAssignmentsDepFile
$DeleteSetContents += [Environment]::NewLine
$DeleteSetContents += (Get-Content $script:policyAssignmentsDepFile)
Remove-Item -Path $script:policyAssignmentsDepFile -Force
{Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents -WhatIf:$true} | Should -Throw
}
It "Deletion of policyAssignmentFile with lock dependency should fail" {
Expand All @@ -1104,6 +1114,7 @@ Describe "Repository" {
$DeleteSetContents += $script:policyAssignmentsDep2File
$DeleteSetContents += [Environment]::NewLine
$DeleteSetContents += (Get-Content $script:policyAssignmentsDep2File)
Remove-Item -Path $script:policyAssignmentsDep2File -Force
{Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents -WhatIf:$true} | Should -Throw
}
#endregion
Expand Down Expand Up @@ -1257,6 +1268,9 @@ Describe "Repository" {
$DeleteSetContents += $script:policyAssignmentsDeletionFile
$DeleteSetContents += [Environment]::NewLine
$DeleteSetContents += (Get-Content $script:policyAssignmentsDeletionFile)
Remove-Item -Path $script:deployCustomRt.FullName[0] -Force
Remove-Item -Path $script:deployCustomLock.FullName -Force
Remove-Item -Path $script:policyAssignmentsDeletionFile -Force
{Invoke-AzOpsPush -ChangeSet $changeSet -DeleteSetContents $deleteSetContents -WhatIf:$false} | Should -Not -Throw
Set-PSFConfig -FullName AzOps.Core.CustomTemplateResourceDeletion -Value $false
Start-Sleep -Seconds 30
Expand Down

0 comments on commit f7a87ca

Please sign in to comment.