[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

@@ -1,13 +1,12 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Describe "Dotnet and tools" {
BeforeAll {
$env:PATH = "/etc/skel/.dotnet/tools:$($env:PATH)"
$dotnetSDKs = dotnet --list-sdks | ConvertTo-Json
$dotnetRuntimes = dotnet --list-runtimes | ConvertTo-Json
}
$dotnetVersions = (Get-ToolsetContent).dotnet.versions
Context "Default" {
@@ -20,11 +19,11 @@ Describe "Dotnet and tools" {
Context "Dotnet $version" {
$dotnet = @{ dotnetVersion = $version }
It "SDK $version is available" -TestCases $dotnet {
It "SDK <dotnetVersion> is available" -TestCases $dotnet {
$dotnetSDKs | Should -Match "$dotnetVersion.[1-9]*"
}
It "Runtime $version is available" -TestCases $dotnet {
It "Runtime <dotnetVersion> is available" -TestCases $dotnet {
$dotnetRuntimes | Should -Match "$dotnetVersion.[1-9]*"
}
}
@@ -38,5 +37,4 @@ Describe "Dotnet and tools" {
"$TestInstance" | Should -ReturnZeroExitCode
}
}
}
}