mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
[Windows] Implement new directories hierarchy (#8616)
This commit is contained in:
committed by
GitHub
parent
84a7deae24
commit
d1f2c9a3be
80
images/windows/scripts/tests/WindowsFeatures.Tests.ps1
Normal file
80
images/windows/scripts/tests/WindowsFeatures.Tests.ps1
Normal file
@@ -0,0 +1,80 @@
|
||||
Describe "WindowsFeatures" {
|
||||
$windowsFeatures = (Get-ToolsetContent).windowsFeatures
|
||||
$testCases = $windowsFeatures | ForEach-Object { @{ Name = $_.name; OptionalFeature = $_.optionalFeature } }
|
||||
|
||||
It "Windows Feature <Name> is installed" -TestCases $testCases {
|
||||
if ($OptionalFeature) {
|
||||
(Get-WindowsOptionalFeature -Online -FeatureName $Name).State | Should -Be "Enabled"
|
||||
} else {
|
||||
(Get-WindowsFeature -Name $Name).InstallState | Should -Be "Installed"
|
||||
}
|
||||
}
|
||||
|
||||
it "Check WSL is on path" {
|
||||
(Get-Command -Name 'wsl') | Should -BeTrue
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Describe "DynamicPorts" {
|
||||
It "Test TCP dynamicport start=49152 num=16384" {
|
||||
$tcpPorts = Get-NetTCPSetting | Where-Object {$_.SettingName -ne "Automatic"} | Where-Object {
|
||||
$_.DynamicPortRangeStartPort -ne 49152 -or $_.DynamicPortRangeNumberOfPorts -ne 16384
|
||||
}
|
||||
|
||||
$tcpPorts | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "Test UDP dynamicport start=49152 num=16384" {
|
||||
$udpPorts = Get-NetUDPSetting | Where-Object {
|
||||
$_.DynamicPortRangeStartPort -ne 49152 -or $_.DynamicPortRangeNumberOfPorts -ne 16384
|
||||
}
|
||||
|
||||
$udpPorts | Should -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Describe "GDIProcessHandleQuota" {
|
||||
It "The GDIProcessHandleQuota value is 20000" {
|
||||
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows"
|
||||
$regPath32 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Windows"
|
||||
(Get-ItemProperty $regPath).GDIProcessHandleQuota | Should -BeExactly 20000
|
||||
(Get-ItemProperty $regPath32).GDIProcessHandleQuota | Should -BeExactly 20000
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Test Signed Drivers" {
|
||||
It "bcdedit testsigning should be Yes"{
|
||||
"$(bcdedit)" | Should -Match "testsigning\s+Yes"
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Windows Updates" {
|
||||
It "WindowsUpdateDone.txt should exist" {
|
||||
"$env:windir\WindowsUpdateDone.txt" | Should -Exist
|
||||
}
|
||||
|
||||
$testCases = Get-WindowsUpdatesHistory | Sort-Object Title | ForEach-Object {
|
||||
@{
|
||||
Title = $_.Title
|
||||
Status = $_.Status
|
||||
}
|
||||
}
|
||||
|
||||
It "<Title>" -TestCases $testCases {
|
||||
$expect = "Successful"
|
||||
if ( $Title -match "Microsoft Defender Antivirus" ) {
|
||||
$expect = "Successful", "Failure", "InProgress"
|
||||
}
|
||||
|
||||
$Status | Should -BeIn $expect
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user