[ubuntu] Refactor pester tests (#9006)

* [ubuntu] Refactor pester tests

* Fix key name and add BeforeAll

* Fix ActionArchiveCache test
This commit is contained in:
Shamil Mubarakshin
2023-12-14 17:33:34 +01:00
committed by GitHub
parent 2179765026
commit dbb10c67ba
15 changed files with 70 additions and 179 deletions

View File

@@ -63,6 +63,7 @@ Describe "Rust" {
}
}
}
Describe "Docker" {
It "docker" {
"docker --version" | Should -ReturnZeroExitCode
@@ -111,13 +112,9 @@ Describe "Bazel" {
}
Describe "clang" {
[array]$testCases = (Get-ToolsetContent).clang.Versions | ForEach-Object { @{ClangVersion = $_} }
$testCases = (Get-ToolsetContent).clang.Versions | ForEach-Object { @{ClangVersion = $_} }
It "clang <ClangVersion>" -TestCases $testCases {
param (
[string] $ClangVersion
)
"clang-$ClangVersion --version" | Should -ReturnZeroExitCode
"clang++-$ClangVersion --version" | Should -ReturnZeroExitCode
"clang-format-$ClangVersion --version" | Should -ReturnZeroExitCode
@@ -136,34 +133,22 @@ Describe "erlang" -Skip:(Test-IsUbuntu22) {
$testCases = @("erl -version", "erlc -v", "rebar3 -v") | ForEach-Object { @{ErlangCommand = $_} }
It "erlang <ErlangCommand>" -TestCases $testCases {
param (
[string] $ErlangCommand
)
"$ErlangCommand" | Should -ReturnZeroExitCode
}
}
Describe "gcc" {
[array]$testCases = (Get-ToolsetContent).gcc.Versions | ForEach-Object { @{GccVersion = $_} }
$testCases = (Get-ToolsetContent).gcc.Versions | ForEach-Object { @{GccVersion = $_} }
It "gcc <GccVersion>" -TestCases $testCases {
param (
[string] $GccVersion
)
"$GccVersion --version" | Should -ReturnZeroExitCode
}
}
Describe "gfortran" {
[array]$testCases = (Get-ToolsetContent).gfortran.Versions | ForEach-Object { @{GfortranVersion = $_} }
$testCases = (Get-ToolsetContent).gfortran.Versions | ForEach-Object { @{GfortranVersion = $_} }
It "gfortran <GfortranVersion>" -TestCases $testCases {
param (
[string] $GfortranVersion
)
"$GfortranVersion --version" | Should -ReturnZeroExitCode
}
}
@@ -323,7 +308,7 @@ Describe "Pulumi" {
Describe "Phantomjs" -Skip:(Test-IsUbuntu22) {
It "phantomjs" {
$env:OPENSSL_CONF="/etc/ssl"; phantomjs --version
$env:OPENSSL_CONF="/etc/ssl"
"phantomjs --version" | Should -ReturnZeroExitCode
}
}
@@ -332,16 +317,14 @@ Describe "Containers" {
$testCases = @("podman", "buildah", "skopeo") | ForEach-Object { @{ContainerCommand = $_} }
It "<ContainerCommand>" -TestCases $testCases {
param (
[string] $ContainerCommand
)
"$ContainerCommand -v" | Should -ReturnZeroExitCode
}
# https://github.com/actions/runner-images/issues/7753
It "podman networking" -TestCases "podman CNI plugins" {
"podman network create -d bridge test-net && podman network ls" | Should -Not -OutputTextMatchingRegex "Error"
"podman network create -d bridge test-net" | Should -ReturnZeroExitCode
"podman network ls" | Should -Not -OutputTextMatchingRegex "Error"
"podman network rm test-net" | Should -ReturnZeroExitCode
}
}
@@ -356,31 +339,20 @@ Describe "Python" {
$testCases = @("python", "pip", "python3", "pip3") | ForEach-Object { @{PythonCommand = $_} }
It "<PythonCommand>" -TestCases $testCases {
param (
[string] $PythonCommand
)
"$PythonCommand --version" | Should -ReturnZeroExitCode
}
}
}
Describe "Ruby" {
$testCases = @("ruby", "gem") | ForEach-Object { @{RubyCommand = $_} }
It "<RubyCommand>" -TestCases $testCases {
param (
[string] $RubyCommand
)
"$RubyCommand --version" | Should -ReturnZeroExitCode
}
$gemTestCases = (Get-ToolsetContent).rubygems | ForEach-Object {
@{gemName = $_.name}
}
$gemTestCases = (Get-ToolsetContent).rubygems | ForEach-Object { @{gemName = $_.name} }
if ($gemTestCases)
{
if ($gemTestCases) {
It "Gem <gemName> is installed" -TestCases $gemTestCases {
"gem list -i '^$gemName$'" | Should -OutputTextMatchingRegex "true"
}
@@ -395,22 +367,22 @@ Describe "yq" {
Describe "Kotlin" {
It "kapt" {
"kapt -version"| Should -ReturnZeroExitCode
"kapt -version" | Should -ReturnZeroExitCode
}
It "kotlin" {
"kotlin -version"| Should -ReturnZeroExitCode
"kotlin -version" | Should -ReturnZeroExitCode
}
It "kotlinc" {
"kotlinc -version"| Should -ReturnZeroExitCode
"kotlinc -version" | Should -ReturnZeroExitCode
}
It "kotlinc-jvm" {
"kotlinc-jvm -version"| Should -ReturnZeroExitCode
"kotlinc-jvm -version" | Should -ReturnZeroExitCode
}
It "kotlin-dce-js" {
"kotlin-dce-js -version"| Should -ReturnZeroExitCode
"kotlin-dce-js -version" | Should -ReturnZeroExitCode
}
}