Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arcbox 3.0 task 930 integration tests #2387

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading