[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

@@ -28,7 +28,7 @@ Describe "Toolset" {
}
}
foreach($tool in $tools) {
foreach ($tool in $tools) {
$toolName = $tool.Name
Context "$toolName" {
$toolExecs = $toolsExecutables[$toolName]
@@ -45,16 +45,15 @@ Describe "Toolset" {
$ExpectedVersionPath | Should -Exist
}
$toolExecs = $toolsExecutables[$toolName]
$foundVersion = Get-Item $expectedVersionPath `
| Sort-Object -Property {[SemVer]$_.name} -Descending `
| Select-Object -First 1
$foundVersionPath = Join-Path $foundVersion $tool.arch
if($toolExecs) {
if ($toolExecs) {
foreach ($executable in $toolExecs["tools"]) {
$executablePath = Join-Path $foundVersionPath $executable
$executablePath = Join-Path $foundVersionPath $executable
It "Validate $executable" -TestCases @{ExecutablePath = $executablePath} {
$ExecutablePath | Should -Exist
}