mirror of
https://github.com/actions/runner-images.git
synced 2025-12-19 00:06:57 +00:00
[ubuntu] Pester tests for dotnet sdk, cmd tools and codeql (#2335)
* dotnet cmd codeql tests * fixed dotnet tests, added codeql to toolset * changed codeql version to wildcard * removed unused import and a test call * tmp * lowercase file name * removed sourcing invoke-tests Co-authored-by: Leonid Lapshin <originalnoe-nazvanie@yandex.ru>
This commit is contained in:
14
images/linux/scripts/tests/Apt.Tests.ps1
Normal file
14
images/linux/scripts/tests/Apt.Tests.ps1
Normal file
@@ -0,0 +1,14 @@
|
||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||
|
||||
$cmd = (Get-ToolsetContent).apt.cmd_packages
|
||||
|
||||
Describe "Apt" {
|
||||
|
||||
$testCases = $cmd | ForEach-Object {
|
||||
@{ toolName = $_ }
|
||||
}
|
||||
|
||||
It "<toolName> is available" -TestCases $testCases {
|
||||
(Get-Command -Name $toolName).CommandType | Should -BeExactly "Application"
|
||||
}
|
||||
}
|
||||
31
images/linux/scripts/tests/DotnetSDK.Tests.ps1
Normal file
31
images/linux/scripts/tests/DotnetSDK.Tests.ps1
Normal file
@@ -0,0 +1,31 @@
|
||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||
|
||||
Describe "Dotnet" {
|
||||
|
||||
BeforeAll {
|
||||
$dotnetSDKs = dotnet --list-sdks | ConvertTo-Json
|
||||
$dotnetRuntimes = dotnet --list-runtimes | ConvertTo-Json
|
||||
}
|
||||
|
||||
$dotnetVersions = (Get-ToolsetContent).dotnet.versions
|
||||
|
||||
Context "Default" {
|
||||
It "Default Dotnet SDK is available" {
|
||||
"dotnet --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($version in $dotnetVersions) {
|
||||
Context "Dotnet $version" {
|
||||
$dotnet = @{ dotnetVersion = $version }
|
||||
|
||||
It "SDK $version is available" -TestCases $dotnet {
|
||||
$dotnetSDKs | Should -Match "$dotnetVersion.[1-9]*"
|
||||
}
|
||||
|
||||
It "Runtime $version is available" -TestCases $dotnet {
|
||||
$dotnetRuntimes | Should -Match "$dotnetVersion.[1-9]*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,10 @@ Describe "Toolset" {
|
||||
tools = @("bin/ruby")
|
||||
command = "--version"
|
||||
}
|
||||
CodeQL = @{
|
||||
tools = @("codeql/codeql")
|
||||
command = "version"
|
||||
}
|
||||
}
|
||||
|
||||
foreach($tool in $tools) {
|
||||
@@ -43,7 +47,7 @@ Describe "Toolset" {
|
||||
|
||||
$toolExecs = $toolsExecutables[$toolName]
|
||||
$foundVersion = Get-Item $expectedVersionPath `
|
||||
| Sort-Object -Property {[version]$_.name} -Descending `
|
||||
| Sort-Object -Property {[SemVer]$_.name} -Descending `
|
||||
| Select-Object -First 1
|
||||
$foundVersionPath = Join-Path $foundVersion $tool.arch
|
||||
|
||||
|
||||
Reference in New Issue
Block a user