Files
runner-images/images/ubuntu/scripts/tests/System.Tests.ps1
2025-10-03 11:25:31 +02:00

25 lines
1.3 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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)) {
It "Image has enough free space" {
$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
}
}
Describe "fwupd removed" {
It "Is not present on box" {
$systemctlOutput = & systemctl list-units fwupd-refresh.timer --no-legend
# When disabled the output looks like this:
# systemctl list-units fwupd-refresh.timer --no-legend
#● fwupd-refresh.timer masked failed failed fwupd-refresh.timer
# When enabled the output looks like this:
# systemctl list-units fwupd-refresh.timer --no-legend
#fwupd-refresh.timer loaded active waiting Refresh fwupd metadata regularly
$systemctlOutput | Should -Not -Match "active"
}
}