mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[Windows] Update Az module pester test (#6902)
This commit is contained in:
@@ -172,4 +172,29 @@ If (Get-Command -Name Add-ShouldOperator -ErrorAction SilentlyContinue) {
|
||||
Add-ShouldOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode}
|
||||
Add-ShouldOperator -Name ReturnZeroExitCodeWithParam -InternalName ShouldReturnZeroExitCodeWithParam -Test ${function:ShouldReturnZeroExitCodeWithParam}
|
||||
Add-ShouldOperator -Name MatchCommandOutput -InternalName ShouldMatchCommandOutput -Test ${function:ShouldMatchCommandOutput}
|
||||
}
|
||||
}
|
||||
|
||||
Function Get-ModuleVersionAsJob {
|
||||
Param (
|
||||
[Parameter(Mandatory)]
|
||||
[String] $modulePath,
|
||||
[Parameter(Mandatory)]
|
||||
[String] $moduleName
|
||||
)
|
||||
# Script block to run commands in separate PowerShell environment
|
||||
$testJob = Start-Job -ScriptBlock {
|
||||
param (
|
||||
$modulePath,
|
||||
$moduleName
|
||||
)
|
||||
# Disable warning messages to prevent additional warnings about Az and Azurerm modules in the same session
|
||||
$WarningPreference = "SilentlyContinue"
|
||||
$env:PsModulePath = "$modulePath;$env:PsModulePath"
|
||||
Import-Module -Name $moduleName
|
||||
(Get-Module -Name $moduleName).Version.ToString()
|
||||
|
||||
} -ArgumentList $modulePath, $moduleName
|
||||
|
||||
$testJob | Wait-Job | Receive-Job | Out-File -FilePath "${env:TEMP}\module-version.txt"
|
||||
Remove-Job $testJob
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user