[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:
Aleksandr Chebotov
2020-12-23 15:18:48 +03:00
committed by GitHub
parent ec4b0fa89c
commit ac87b63b13
12 changed files with 162 additions and 72 deletions

View 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"