-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4134 from NikCharlebois/FixesInt
Added AAD Update and Remove Tests
- Loading branch information
Showing
1 changed file
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,3 +86,120 @@ jobs: | |
{ | ||
Write-Host "All resources in the Tenant are in the Desired State" | ||
} | ||
- name: Generate {Update} Integration Tests from Examples | ||
shell: powershell | ||
run: | | ||
Import-Module './Tests/Integration/M365DSCTestEngine.psm1' | ||
New-M365DSCIntegrationTest -Workload AAD -Step '2-Update' | ||
- name: Commit {Update} Integration Tests | ||
shell: powershell | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "NikCharlebois" | ||
git add D:/a/Microsoft365DSC/Microsoft365DSC/Tests/Integration/* | ||
git pull | ||
git commit -m "Updated {Update} AAD Integration Tests" | ||
git push | ||
$SHA = git rev-parse HEAD | ||
echo "commitid=$SHA" >> $env:GITHUB_OUTPUT | ||
- name: Run {Update} Integration Tests | ||
shell: powershell | ||
env: | ||
INTEGRATION_USERNAME: ${{ secrets.INTEGRATION_USERNAME }} | ||
INTEGRATION_PASSWORD: ${{ secrets.INTEGRATION_PASSWORD }} | ||
run: | | ||
$CredPassword = ConvertTo-SecureString $env:INTEGRATION_PASSWORD -AsPlainText -Force | ||
$Credential = New-Object System.Management.Automation.PSCredential ($env:INTEGRATION_USERNAME, $CredPassword) | ||
try | ||
{ | ||
& .\Tests\Integration\Microsoft365DSC\M365DSCIntegration.AAD.Update.Tests.ps1 -Credential $Credential | ||
} | ||
catch | ||
{ | ||
throw $_ | ||
} | ||
try | ||
{ | ||
$Result = Test-DSCConfiguration -Detailed -Verbose -ErrorAction Stop | ||
} | ||
catch | ||
{ | ||
throw $_ | ||
} | ||
Write-Host "" | ||
if ($Result.InDesiredState -eq $false) | ||
{ | ||
Write-Host -Message "Resources below are not in the Desired State:" | ||
foreach ($Resource in $Result.ResourcesNotInDesiredState) | ||
{ | ||
Write-Host $Resource.InstanceName | ||
} | ||
throw "Could not validate that the Tenant is in the Desired State" | ||
} | ||
else | ||
{ | ||
Write-Host "All resources in the Tenant are in the Desired State" | ||
} | ||
- name: Generate {Remove} Integration Tests from Examples | ||
shell: powershell | ||
run: | | ||
Import-Module './Tests/Integration/M365DSCTestEngine.psm1' | ||
New-M365DSCIntegrationTest -Workload AAD -Step '3-Remove' | ||
- name: Commit {Remove} Integration Tests | ||
shell: powershell | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "NikCharlebois" | ||
git add D:/a/Microsoft365DSC/Microsoft365DSC/Tests/Integration/* | ||
git pull | ||
git commit -m "Updated {Update} AAD Integration Tests" | ||
git push | ||
$SHA = git rev-parse HEAD | ||
echo "commitid=$SHA" >> $env:GITHUB_OUTPUT | ||
- name: Run {Remove} Integration Tests | ||
shell: powershell | ||
env: | ||
INTEGRATION_USERNAME: ${{ secrets.INTEGRATION_USERNAME }} | ||
INTEGRATION_PASSWORD: ${{ secrets.INTEGRATION_PASSWORD }} | ||
run: | | ||
$CredPassword = ConvertTo-SecureString $env:INTEGRATION_PASSWORD -AsPlainText -Force | ||
$Credential = New-Object System.Management.Automation.PSCredential ($env:INTEGRATION_USERNAME, $CredPassword) | ||
try | ||
{ | ||
& .\Tests\Integration\Microsoft365DSC\M365DSCIntegration.AAD.Remove.Tests.ps1 -Credential $Credential | ||
} | ||
catch | ||
{ | ||
throw $_ | ||
} | ||
try | ||
{ | ||
$Result = Test-DSCConfiguration -Detailed -Verbose -ErrorAction Stop | ||
} | ||
catch | ||
{ | ||
throw $_ | ||
} | ||
Write-Host "" | ||
if ($Result.InDesiredState -eq $false) | ||
{ | ||
Write-Host -Message "Resources below are not in the Desired State:" | ||
foreach ($Resource in $Result.ResourcesNotInDesiredState) | ||
{ | ||
Write-Host $Resource.InstanceName | ||
} | ||
throw "Could not validate that the Tenant is in the Desired State" | ||
} | ||
else | ||
{ | ||
Write-Host "All resources in the Tenant are in the Desired State" | ||
} | ||