2024-01-15 11:57:43 +01:00
|
|
|
|
# The $env:AGENT_NAME and $env:RUNNER_NAME are predefined variables for the ADO pipelines and for the GitHub actions respectively.
|
|
|
|
|
|
# If the test is running on the ADO pipeline or on the GitHub actions, the test will be skipped
|
|
|
|
|
|
Describe "Disk free space" -Skip:(-not [String]::IsNullOrEmpty($env:AGENT_NAME) -or -not [String]::IsNullOrEmpty($env:RUNNER_NAME)) {
|
2024-01-30 13:05:32 +01:00
|
|
|
|
It "Image has enough free space" {
|
2025-10-03 11:25:31 +02:00
|
|
|
|
$diskInfo = Get-PSDrive "/"
|
|
|
|
|
|
$totalSpaceGB = [math]::Floor(($diskInfo.Used + $diskInfo.Free) / 1GB)
|
|
|
|
|
|
$freeSpaceGB = [math]::Floor($diskInfo.Free / 1GB)
|
|
|
|
|
|
Write-Host " [i] Disk size: ${totalSpaceGB} GB; Free space: ${freeSpaceGB} GB"
|
|
|
|
|
|
$freeSpaceGB | Should -BeGreaterOrEqual 17
|
2023-11-22 21:49:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-05-22 20:59:38 +01:00
|
|
|
|
|
|
|
|
|
|
Describe "fwupd removed" {
|
|
|
|
|
|
It "Is not present on box" {
|
2025-08-06 13:48:10 +01:00
|
|
|
|
$systemctlOutput = & systemctl list-units fwupd-refresh.timer --no-legend
|
2025-05-27 09:33:33 +01:00
|
|
|
|
# When disabled the output looks like this:
|
|
|
|
|
|
#❯ systemctl list-units fwupd-refresh.timer --no-legend
|
|
|
|
|
|
#● fwupd-refresh.timer masked failed failed fwupd-refresh.timer
|
2025-05-23 17:08:28 +01:00
|
|
|
|
# When enabled the output looks like this:
|
2025-05-27 09:33:33 +01:00
|
|
|
|
#❯ systemctl list-units fwupd-refresh.timer --no-legend
|
|
|
|
|
|
#fwupd-refresh.timer loaded active waiting Refresh fwupd metadata regularly
|
|
|
|
|
|
$systemctlOutput | Should -Not -Match "active"
|
2025-05-22 20:59:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-19 14:54:05 +02:00
|
|
|
|
|
|
|
|
|
|
# https://github.com/actions/runner-images/issues/13770
|
|
|
|
|
|
# Linux kernel 6.17 changed read_ahead_kb from 128 to 4096 on Azure VMs, causing I/O thrashing
|
|
|
|
|
|
Describe "ReadAhead udev rule" -Skip:(-not (Test-IsUbuntu24)) {
|
|
|
|
|
|
It "udev rule file exists" {
|
|
|
|
|
|
"/etc/udev/rules.d/99-readahead.rules" | Should -Exist
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
It "udev rule contains correct read_ahead_kb value" {
|
|
|
|
|
|
$content = Get-Content "/etc/udev/rules.d/99-readahead.rules" -Raw
|
|
|
|
|
|
$content | Should -Match 'ATTR\{queue/read_ahead_kb\}="128"'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
It "All sd* devices have read_ahead_kb set to 128" {
|
|
|
|
|
|
$devices = Get-ChildItem "/sys/block/sd*/queue/read_ahead_kb" -ErrorAction SilentlyContinue
|
|
|
|
|
|
$devices | Should -Not -BeNullOrEmpty -Because "there should be at least one sd* block device"
|
|
|
|
|
|
foreach ($dev in $devices) {
|
|
|
|
|
|
$value = (Get-Content $dev.FullName).Trim()
|
|
|
|
|
|
$value | Should -Be "128" -Because "read_ahead_kb for $($dev.FullName) should be 128 to prevent I/O thrashing"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|