mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 20:56:47 +00:00
[Ubuntu] Implement first Pester tests (#2270)
* implement first pester tests * add comment for azcopy test * remove extra importing and old function * resolve comments * fix typo
This commit is contained in:
committed by
GitHub
parent
be672cb22c
commit
2b93b03377
35
images/linux/scripts/helpers/Common.Helpers.psm1
Normal file
35
images/linux/scripts/helpers/Common.Helpers.psm1
Normal file
@@ -0,0 +1,35 @@
|
||||
function Get-CommandResult {
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string] $Command,
|
||||
[switch] $Multiline
|
||||
)
|
||||
# Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version")
|
||||
$stdout = & bash -c "$Command 2>&1"
|
||||
$exitCode = $LASTEXITCODE
|
||||
return @{
|
||||
Output = If ($Multiline -eq $true) { $stdout } else { [string]$stdout }
|
||||
ExitCode = $exitCode
|
||||
}
|
||||
}
|
||||
|
||||
function Get-OSName {
|
||||
lsb_release -ds
|
||||
}
|
||||
|
||||
function Test-IsUbuntu16 {
|
||||
return (lsb_release -rs) -eq "16.04"
|
||||
}
|
||||
|
||||
function Test-IsUbuntu18 {
|
||||
return (lsb_release -rs) -eq "18.04"
|
||||
}
|
||||
|
||||
function Test-IsUbuntu20 {
|
||||
return (lsb_release -rs) -eq "20.04"
|
||||
}
|
||||
|
||||
function Get-ToolsetContent {
|
||||
$toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json"
|
||||
Get-Content $toolset -Raw | ConvertFrom-Json
|
||||
}
|
||||
Reference in New Issue
Block a user