mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
[Ubuntu] Migrate PowerShell and Docker tests to Pester (#2317)
* PowerShell and Docker Pester tests * no pester module * import pester * invoke docker with sudo * remove native test * add fix for az 1.0.0 module * revert powershellget installation * revert flag Force * add $ProgressPreference = "SilentlyContinue"
This commit is contained in:
committed by
GitHub
parent
ec4b0fa89c
commit
ac87b63b13
31
images/linux/scripts/installers/Install-AzureModules.ps1
Normal file
31
images/linux/scripts/installers/Install-AzureModules.ps1
Normal file
@@ -0,0 +1,31 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
|
||||
Import-Module "$env:HELPER_SCRIPTS/Tests.Helpers.psm1" -DisableNameChecking
|
||||
|
||||
# Get modules content from toolset
|
||||
$modules = (Get-ToolsetContent).azureModules
|
||||
$installPSModulePath = "/usr/share"
|
||||
|
||||
foreach ($module in $modules)
|
||||
{
|
||||
$moduleName = $module.name
|
||||
Write-Host "Installing ${moduleName} to the ${installPSModulePath} path..."
|
||||
foreach ($version in $module.versions)
|
||||
{
|
||||
$modulePath = Join-Path -Path $installPSModulePath -ChildPath "${moduleName}_${version}"
|
||||
Write-Host " - $version [$modulePath]"
|
||||
Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -Force -Verbose
|
||||
}
|
||||
}
|
||||
|
||||
# If Az.Accounts > 1.0.0 unable to load module with error: Assembly with same name is already loaded
|
||||
# Force install Az.Accounts 1.0.0
|
||||
$azAccountsPath = "/usr/share/az_1.0.0/Az.Accounts"
|
||||
if (Test-Path $azAccountsPath)
|
||||
{
|
||||
Remove-Item -Path $azAccountsPath -Force -Recurse
|
||||
Save-Module -Name Az.Accounts -Path "/usr/share/az_1.0.0" -RequiredVersion 1.0.0 -Force
|
||||
}
|
||||
|
||||
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "AzureModules"
|
||||
Reference in New Issue
Block a user