From 52019144a83d5d81e4f9f3e3caf454251c20e614 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Fri, 23 May 2025 14:18:25 +0100 Subject: [PATCH 1/4] Fix fwupd intergration test on Ubuntu 22.04 See: - https://github.com/actions/runner-images/pull/12225#issuecomment-2904383955 --- images/ubuntu/scripts/tests/System.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/ubuntu/scripts/tests/System.Tests.ps1 b/images/ubuntu/scripts/tests/System.Tests.ps1 index f3d034831..2204199c0 100644 --- a/images/ubuntu/scripts/tests/System.Tests.ps1 +++ b/images/ubuntu/scripts/tests/System.Tests.ps1 @@ -10,6 +10,6 @@ Describe "Disk free space" -Skip:(-not [String]::IsNullOrEmpty($env:AGENT_NAME) Describe "fwupd removed" { It "Is not present on box" { $systemctlOutput = & systemctl list-unit-files fwupd-refresh.timer - $systemctlOutput | Should -Match "masked" + ($systemctlOutput -eq $null) -or ($systemctlOutput | Should -Match "masked") } } From a1cf69345ecf6ead26b4b2206048e0b3011b95c6 Mon Sep 17 00:00:00 2001 From: Lawrence Gripper Date: Fri, 23 May 2025 14:23:44 +0100 Subject: [PATCH 2/4] Update images/ubuntu/scripts/tests/System.Tests.ps1 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- images/ubuntu/scripts/tests/System.Tests.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/images/ubuntu/scripts/tests/System.Tests.ps1 b/images/ubuntu/scripts/tests/System.Tests.ps1 index 2204199c0..1396613ae 100644 --- a/images/ubuntu/scripts/tests/System.Tests.ps1 +++ b/images/ubuntu/scripts/tests/System.Tests.ps1 @@ -10,6 +10,11 @@ Describe "Disk free space" -Skip:(-not [String]::IsNullOrEmpty($env:AGENT_NAME) Describe "fwupd removed" { It "Is not present on box" { $systemctlOutput = & systemctl list-unit-files fwupd-refresh.timer - ($systemctlOutput -eq $null) -or ($systemctlOutput | Should -Match "masked") + if ($systemctlOutput -eq $null) { + # Service not installed, test passes + return + } else { + $systemctlOutput | Should -Match "masked" + } } } From 6fcdd215dcad754c26a403d88ee592c6f72fe3f8 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Fri, 23 May 2025 17:08:28 +0100 Subject: [PATCH 3/4] Make test robust --- images/ubuntu/scripts/tests/System.Tests.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/images/ubuntu/scripts/tests/System.Tests.ps1 b/images/ubuntu/scripts/tests/System.Tests.ps1 index 1396613ae..96a176912 100644 --- a/images/ubuntu/scripts/tests/System.Tests.ps1 +++ b/images/ubuntu/scripts/tests/System.Tests.ps1 @@ -10,11 +10,11 @@ Describe "Disk free space" -Skip:(-not [String]::IsNullOrEmpty($env:AGENT_NAME) Describe "fwupd removed" { It "Is not present on box" { $systemctlOutput = & systemctl list-unit-files fwupd-refresh.timer - if ($systemctlOutput -eq $null) { - # Service not installed, test passes - return - } else { - $systemctlOutput | Should -Match "masked" - } + # When enabled the output looks like this: + #❯ systemctl list-unit-files fwupd-refresh.timer + #UNIT FILE STATE VENDOR PRESET + #fwupd-refresh.timer enabled enabled + #1 unit files listed. + $systemctlOutput | Should -Not -Match "enabled" } } From fb7e986316c26e76b8eeaa3bc8e699b972d79e75 Mon Sep 17 00:00:00 2001 From: lawrencegripper Date: Tue, 27 May 2025 09:33:33 +0100 Subject: [PATCH 4/4] Fix up by using list-unit This avoids the output containing the preset vendor value. --- images/ubuntu/scripts/tests/System.Tests.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/images/ubuntu/scripts/tests/System.Tests.ps1 b/images/ubuntu/scripts/tests/System.Tests.ps1 index 96a176912..e609fea7c 100644 --- a/images/ubuntu/scripts/tests/System.Tests.ps1 +++ b/images/ubuntu/scripts/tests/System.Tests.ps1 @@ -9,12 +9,13 @@ Describe "Disk free space" -Skip:(-not [String]::IsNullOrEmpty($env:AGENT_NAME) Describe "fwupd removed" { It "Is not present on box" { - $systemctlOutput = & systemctl list-unit-files fwupd-refresh.timer + $systemctlOutput = & systemctl list-unit 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-unit-files fwupd-refresh.timer - #UNIT FILE STATE VENDOR PRESET - #fwupd-refresh.timer enabled enabled - #1 unit files listed. - $systemctlOutput | Should -Not -Match "enabled" + #❯ systemctl list-units fwupd-refresh.timer --no-legend + #fwupd-refresh.timer loaded active waiting Refresh fwupd metadata regularly + $systemctlOutput | Should -Not -Match "active" } }