mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
Add Pester tests for Windows Features (#1225)
* Add Windows Features Pester tests * Move win feature tests to separate file * Remove validation script for disc space * Remove Windows updates test
This commit is contained in:
committed by
GitHub
parent
6bc236a514
commit
956b8a0093
41
images/win/scripts/Tests/WindowsFeatures.Tests.ps1
Normal file
41
images/win/scripts/Tests/WindowsFeatures.Tests.ps1
Normal file
@@ -0,0 +1,41 @@
|
||||
Describe "WindowsFeatures" {
|
||||
|
||||
$testCases = @(
|
||||
@{ FeatureName = "NET-Framework-Features" }
|
||||
@{ FeatureName = "NET-Framework-45-Features" }
|
||||
@{ FeatureName = "FS-iSCSITarget-Server" }
|
||||
)
|
||||
|
||||
if (Test-isWin16) {
|
||||
$testCases += @{ FeatureName = "BITS" }
|
||||
$testCases += @{ FeatureName = "DSC-Service" }
|
||||
}
|
||||
if (Test-isWin19) {
|
||||
$testCases += @{ FeatureName = "Microsoft-Windows-Subsystem-Linux" }
|
||||
}
|
||||
|
||||
It "Windows Feature <FeatureName> is installed" -TestCases $testCases {
|
||||
(Get-WindowsFeature -Name $FeatureName).InstallState | Should -Be "Installed"
|
||||
}
|
||||
|
||||
if (Test-isWin19) {
|
||||
it "Check WSL is on path" {
|
||||
(Get-Command -Name 'wsl') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "ContainersFeature" {
|
||||
It "Windows containers feature is installed" {
|
||||
(Get-WindowsFeature -Name "Containers").InstallState | Should -Be "Installed"
|
||||
}
|
||||
}
|
||||
|
||||
Describe "DiskSpace" {
|
||||
it "The image has enough disk space"{
|
||||
$availableSpaceMB = [math]::Round((Get-PSDrive -Name C).Free / 1MB)
|
||||
$minimumFreeSpaceMB = 18 * 1024
|
||||
|
||||
$availableSpaceMB | Should -BeGreaterThan $minimumFreeSpaceMB
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user