Skip to content

Commit

Permalink
Merge pull request #2387 from janegilring/arcbox_3.0_task_930_integra…
Browse files Browse the repository at this point in the history
…tion_tests

Arcbox 3.0 task 930 integration tests
  • Loading branch information
janegilring authored Jan 27, 2024
2 parents fcb670b + a7a5c66 commit 5c17d79
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 46 deletions.
9 changes: 8 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ parameters:
displayName: 'githubBranch'
type: string
default: 'arcbox_3.0'
- name: flavor
displayName: 'flavor'
type: string
default: 'ITPro'

variables:
- group: 'integration-tests'
Expand All @@ -32,6 +36,8 @@ variables:
value: ${{parameters.githubAccount}}
- name: githubBranch
value: ${{parameters.githubBranch}}
- name: flavor
value: ${{parameters.flavor}}

stages:
- stage: 'ArcBox_deployment'
Expand Down Expand Up @@ -70,6 +76,7 @@ stages:
Write-Host "Deploying to $(ResourceGroupName)"
$githubAccount = "$(githubAccount)"
$githubBranch = "$(githubBranch)"
$flavor = "$(flavor)"
if ($githubAccount -ne "microsoft") {
Write-Host "Checking out $githubAccount/$githubBranch"
git remote add upstream https://github.com/$($githubAccount)/azure_arc.git
Expand All @@ -87,7 +94,7 @@ stages:
windowsAdminPassword = "$(windowsAdminPassword)" ; `
sshRSAPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCsdlSaF10Uw0fFysiIV0VYeJGE1CaV0ZjZcakcKgafiqZ04sAzf7KnoIjPVyx6LXoDTKGtv1e5eFjRZA7Z0Bu+a3JqY252/yr/B2R3Mu5qZHbKFncpVEXn7sUmYk4rDG5vToFxbhpKX5EGyvM1M0quoUv3Uv9reBsSDdjk7n7oA2Q+89rj4nfRuTEMQRwvNBaLeNRSlWuzPq4EkpwxSWRzIC2auC5K0rxGiTMPTXMOQ3l0DvzKRoEsygHA4c3uw0PTntSlgSSTgtGdQfuX63hAD4QPTVfeQdsW5+Nq3clr+6SHgeGdwHhKjUVTF+E2olfSYtuV4CqPW8dZdDBOZg7pXLMSVumZVKCZiUV6uBJkvLBRMzMiFsfXOVrgyThMqq+8y4tg/V3l/3S8z5Lngy4WoCAQMHQ1SloPmy9s4QnbjCFEQx/cIq9H+Uw6HAYhdQFh/w/tuIP+KIqOpMOrltZuaoqx3AOOL3BPXJMbv3opiZxCEZQFf68n+Zn6uRc9u1EENA9s1DrjG1j/CHWzbX/t63Ig/xQLgKLu9T+evua3dcWsYc3j1Gvk8R+ioXV7x0/fi6twrhSQxBIIL0D2Pxm8TBfJ3mVXk0kYGGq1mBsoxAzjoBhcbdwUMXHbAksj4/UuuAK5VfH278hlXo/BHSgDLZ98fdS63nq7rIr6qWmBrQ==" ; `
logAnalyticsWorkspaceName = "arcbox-la" ; `
flavor = "ITPro" ; `
flavor = $flavor ; `
deployBastion = $false ; `
githubAccount = $githubAccount ; `
githubBranch = $githubBranch ; `
Expand Down
45 changes: 1 addition & 44 deletions azure_jumpstart_arcbox/artifacts/ArcServersLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -463,50 +463,7 @@ Set-JSDesktopBackground -ImagePath "$Env:ArcBoxDir\wallpaper.bmp"

Write-Header "Running tests to verify infrastructure"

Invoke-Pester -Path "$Env:ArcBoxTestsDir\common.tests.ps1" -Output Detailed -PassThru -OutVariable tests_common
$tests_passed = $tests_common.Passed.Count
$tests_failed = $tests_common.Failed.Count

switch ($env:flavor) {
'DevOps' {
Invoke-Pester -Path "$Env:ArcBoxTestsDir\devops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_devops
$tests_passed = $tests_passed + $tests_devops.Passed.Count
$tests_failed = $tests_failed + $tests_devops.Failed.Count
}
'DataOps' {
Invoke-Pester -Path "$Env:ArcBoxTestsDir\dataops.tests.ps1" -Output Detailed -Output Detailed -PassThru -OutVariable tests_dataops
$tests_passed = $tests_passed + $tests_dataops.Passed.Count
$tests_failed = $tests_failed + $tests_dataops.Failed.Count
}
'ITPro' {
Invoke-Pester -Path "$Env:ArcBoxTestsDir\itpro.tests.ps1" -Output Detailed -PassThru -OutVariable tests_itpro
$tests_passed = $tests_passed + $tests_itpro.Passed.Count
$tests_failed = $tests_failed + $tests_itpro.Failed.Count
}
'Full' {
Invoke-Pester -Path "$Env:ArcBoxTestsDir\devops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_devops
$tests_passed = $tests_passed + $tests_devops.Passed.Count
$tests_failed = $tests_failed + $tests_devops.Failed.Count

Invoke-Pester -Path "$Env:ArcBoxTestsDir\dataops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_dataops
$tests_passed = $tests_passed + $tests_dataops.Passed.Count
$tests_failed = $tests_failed + $tests_dataops.Failed.Count

Invoke-Pester -Path "$Env:ArcBoxTestsDir\itpro.tests.ps1" -Output Detailed -PassThru -OutVariable tests_itpro
$tests_passed = $tests_passed + $tests_itpro.Passed.Count
$tests_failed = $tests_failed + $tests_itpro.Failed.Count
}
}

Write-Output "Tests succeeded: $tests_passed"
Write-Output "Tests failed: $tests_failed"

Write-Header "Adding deployment test results to wallpaper using BGInfo"

Set-Content "$Env:windir\TEMP\arcbox-tests-succeeded.txt" $tests_passed
Set-Content "$Env:windir\TEMP\arcbox-tests-failed.txt" $tests_failed

bginfo.exe $Env:ArcBoxTestsDir\arcbox-bginfo.bgi /timer:0 /NOLICPROMPT
& "$Env:ArcBoxTestsDir\Invoke-Test.ps1"

Write-Header "Creating deployment logs bundle"

Expand Down
3 changes: 3 additions & 0 deletions azure_jumpstart_arcbox/artifacts/Bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ foreach ($module in $modules) {
Install-PSResource -Name $module -Scope AllUsers -Quiet -AcceptLicense -TrustRepository
}

# Temporary workaround for Posh-SSH module due to: https://github.com/darkoperator/Posh-SSH/issues/558
Install-PSResource -Name Posh-SSH -Scope AllUsers -Quiet -AcceptLicense -TrustRepository -Prerelease

# Installing DHCP service
Write-Output "Installing DHCP service"
Install-WindowsFeature -Name "DHCP" -IncludeManagementTools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ Write-Output "Get-PesterResult.ps1 started in $(hostname.exe) as user $(whoami.e

$timeout = New-TimeSpan -Minutes 180
$endTime = (Get-Date).Add($timeout)
$logFilePath = "C:\ArcBox\Logs\ArcServersLogonScript.log"


switch ($env:flavor) {
'DevOps' {
$logFilePath = "$Env:ArcBoxLogsDir\DevOpsLogonScript.log"
}
'DataOps' {
$logFilePath = "$Env:ArcBoxLogsDir\DataOpsLogonScript.log"
}
'ITPro' {
$logFilePath = "$Env:ArcBoxLogsDir\ArcServersLogonScript.log"
}
'default' {
throw "Unknown flavor $env:flavor"
}
}

Write-Output "Adding Storage Blob Data Contributor role assignment to SPN $env:spnClientId for allowing upload of Pester test results to Azure Storage"

Expand Down
44 changes: 44 additions & 0 deletions azure_jumpstart_arcbox/artifacts/tests/Invoke-Test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Invoke-Pester -Path "$Env:ArcBoxTestsDir\common.tests.ps1" -Output Detailed -PassThru -OutVariable tests_common
$tests_passed = $tests_common.Passed.Count
$tests_failed = $tests_common.Failed.Count

switch ($env:flavor) {
'DevOps' {
Invoke-Pester -Path "$Env:ArcBoxTestsDir\devops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_devops
$tests_passed = $tests_passed + $tests_devops.Passed.Count
$tests_failed = $tests_failed + $tests_devops.Failed.Count
}
'DataOps' {
Invoke-Pester -Path "$Env:ArcBoxTestsDir\dataops.tests.ps1" -Output Detailed -Output Detailed -PassThru -OutVariable tests_dataops
$tests_passed = $tests_passed + $tests_dataops.Passed.Count
$tests_failed = $tests_failed + $tests_dataops.Failed.Count
}
'ITPro' {
Invoke-Pester -Path "$Env:ArcBoxTestsDir\itpro.tests.ps1" -Output Detailed -PassThru -OutVariable tests_itpro
$tests_passed = $tests_passed + $tests_itpro.Passed.Count
$tests_failed = $tests_failed + $tests_itpro.Failed.Count
}
'Full' {
Invoke-Pester -Path "$Env:ArcBoxTestsDir\devops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_devops
$tests_passed = $tests_passed + $tests_devops.Passed.Count
$tests_failed = $tests_failed + $tests_devops.Failed.Count

Invoke-Pester -Path "$Env:ArcBoxTestsDir\dataops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_dataops
$tests_passed = $tests_passed + $tests_dataops.Passed.Count
$tests_failed = $tests_failed + $tests_dataops.Failed.Count

Invoke-Pester -Path "$Env:ArcBoxTestsDir\itpro.tests.ps1" -Output Detailed -PassThru -OutVariable tests_itpro
$tests_passed = $tests_passed + $tests_itpro.Passed.Count
$tests_failed = $tests_failed + $tests_itpro.Failed.Count
}
}

Write-Output "Tests succeeded: $tests_passed"
Write-Output "Tests failed: $tests_failed"

Write-Header "Adding deployment test results to wallpaper using BGInfo"

Set-Content "$Env:windir\TEMP\arcbox-tests-succeeded.txt" $tests_passed
Set-Content "$Env:windir\TEMP\arcbox-tests-failed.txt" $tests_failed

bginfo.exe $Env:ArcBoxTestsDir\arcbox-bginfo.bgi /timer:0 /NOLICPROMPT

0 comments on commit 5c17d79

Please sign in to comment.